/* =========================================================
   TOONIST — board (portfolio list + detail + admin)
   Loaded after css/style.css
   ========================================================= */

.page-board {
  background: var(--paper-dim);
}

/* ---------- board hero ---------- */
.board-hero {
  position: relative;
  padding: clamp(120px, 15vw, 176px) 0 clamp(36px, 4.5vw, 56px);
  background: var(--ink-900);
  color: var(--paper);
  overflow: hidden;
}

.board-hero::before {
  content: "";
  position: absolute;
  top: -30%;
  right: -10%;
  width: min(70vw, 720px);
  aspect-ratio: 1;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(217, 165, 102, 0.2),
    transparent 66%
  );
  pointer-events: none;
}

.board-hero .wrap {
  position: relative;
}

.board-eyebrow {
  margin-bottom: clamp(18px, 2.4vw, 26px);
}

.board-title {
  font-family: var(--ff-serif);
  font-weight: 300;
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.24;
  letter-spacing: -0.05em;
}

.board-lead {
  margin-top: clamp(18px, 2.2vw, 24px);
  max-width: 40rem;
  font-size: clamp(0.94rem, 1.1vw, 1.02rem);
  line-height: 1.85;
  color: var(--paper-muted);
}

/* external nav link (.nav-external) is defined in css/style.css
   so it also applies on index.html, which does not load this file */

/* ---------- curriculum flow ---------- */
.board-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0;
  row-gap: 12px;
  margin-top: clamp(26px, 3.4vw, 38px);
  padding-top: clamp(20px, 2.6vw, 28px);
  border-top: 1px solid var(--line);
}

.board-flow li {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--ff-serif);
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  color: rgba(247, 243, 236, 0.78);
}

.board-flow li span {
  font-family: var(--ff-display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.board-flow li:not(:last-child)::after {
  content: "";
  width: 22px;
  height: 1px;
  margin: 0 14px;
  background: rgba(247, 243, 236, 0.22);
  align-self: center;
}

/* ---------- atoon band ---------- */
.atoon-band {
  position: relative;
  background: var(--ink-800);
  border-top: 1px solid var(--line);
  color: var(--paper);
  overflow: hidden;
}

.atoon-band::before {
  content: "";
  position: absolute;
  top: -60%;
  right: -6%;
  width: min(58vw, 560px);
  aspect-ratio: 1;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(217, 165, 102, 0.2),
    transparent 66%
  );
  pointer-events: none;
}

.atoon-inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(36px, 5vw, 60px) var(--gutter);
}

.atoon-label {
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.atoon-title {
  font-family: var(--ff-serif);
  font-weight: 300;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: -0.04em;
}

.atoon-title em {
  font-family: var(--ff-display);
  font-style: normal;
  font-size: 0.62em;
  letter-spacing: 0.2em;
  color: rgba(247, 243, 236, 0.4);
  margin-left: 8px;
}

.atoon-desc {
  margin-top: 10px;
  max-width: 32rem;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--paper-muted);
}

.atoon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  border-color: var(--accent);
  color: #16120d;
  font-weight: 500;
}

.atoon-btn:hover {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink-900);
}

.atoon-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- board body ---------- */
.board-body {
  padding: clamp(32px, 4vw, 48px) 0 clamp(72px, 9vw, 116px);
  /* board sits on the light paper surface — keep text dark */
  color: var(--ink-900);
}

.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: clamp(22px, 2.6vw, 30px);
  border-bottom: 1px solid rgba(15, 13, 12, 0.14);
}

.board-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 17px;
  border-radius: 100px;
  border: 1px solid rgba(15, 13, 12, 0.18);
  background: transparent;
  font-size: 0.82rem;
  color: rgba(15, 13, 12, 0.68);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.chip:hover {
  border-color: rgba(15, 13, 12, 0.36);
  color: var(--ink-900);
}

.chip.is-active {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: var(--paper);
}

.board-count {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: rgba(15, 13, 12, 0.46);
}

.board-grid {
  margin-top: clamp(26px, 3.2vw, 38px);
}

/* cards are buttons on the board page */
button.p-card {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

button.p-card:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
}

/* ---------- detail modal ---------- */
.detail {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 32px);
}

.detail[hidden] {
  display: none;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 9, 8, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.3s var(--ease) both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.detail-panel {
  position: relative;
  width: min(100%, 860px);
  max-height: min(88vh, 900px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border: 1px solid rgba(15, 13, 12, 0.16);
  border-radius: 4px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.7);
  animation: panelIn 0.42s var(--ease) both;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.detail-close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 3;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(15, 13, 12, 0.62);
  color: var(--paper);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background-color 0.3s var(--ease);
}

.detail-close:hover {
  background: var(--ink-900);
}

.detail-close svg {
  width: 18px;
  height: 18px;
}

.detail-media {
  position: relative;
  background: #14110f;
}

.detail-media img {
  width: 100%;
  height: auto;
  max-height: 52vh;
  object-fit: cover;
  display: block;
}

.detail-media.is-text {
  display: grid;
  place-items: center;
  min-height: 180px;
  background: linear-gradient(150deg, #1c1917, #332d28);
}

.detail-media.is-text span {
  font-family: var(--ff-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 200;
  letter-spacing: 0.05em;
  color: rgba(247, 243, 236, 0.32);
  padding: 0 24px;
  text-align: center;
}

.detail-content {
  padding: clamp(22px, 3vw, 36px);
  color: var(--ink-900);
}

.detail-cat {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 12px;
}

.detail-title {
  font-family: var(--ff-serif);
  font-weight: 500;
  font-size: clamp(1.3rem, 2.6vw, 1.82rem);
  letter-spacing: -0.04em;
  line-height: 1.36;
}

.detail-meta {
  margin-top: 10px;
  font-size: 0.82rem;
  color: rgba(15, 13, 12, 0.5);
}

.detail-text {
  margin-top: clamp(18px, 2.4vw, 26px);
  padding-top: clamp(18px, 2.4vw, 24px);
  border-top: 1px solid rgba(15, 13, 12, 0.12);
  font-size: 0.94rem;
  line-height: 1.9;
  color: rgba(15, 13, 12, 0.76);
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-link {
  margin-top: clamp(20px, 2.6vw, 28px);
}

/* =========================================================
   ADMIN
   ========================================================= */
.page-admin {
  background: var(--ink-900);
  color: var(--paper);
  min-height: 100vh;
}

.admin-main {
  padding: clamp(104px, 13vw, 140px) 0 clamp(64px, 8vw, 100px);
  min-height: 100vh;
}

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: clamp(22px, 2.6vw, 30px);
  border-bottom: 1px solid var(--line);
}

.admin-title {
  font-family: var(--ff-serif);
  font-weight: 300;
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  letter-spacing: -0.04em;
}

.admin-sub {
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--paper-muted);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-sm {
  padding: 10px 18px;
  font-size: 0.82rem;
}

/* ---------- gate (login) card ---------- */
.gate {
  max-width: 460px;
  margin: clamp(40px, 6vw, 72px) auto 0;
  padding: clamp(26px, 3.6vw, 40px);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: linear-gradient(
    168deg,
    rgba(247, 243, 236, 0.055),
    rgba(247, 243, 236, 0.012)
  );
}

.gate h2 {
  font-family: var(--ff-serif);
  font-weight: 300;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  letter-spacing: -0.03em;
}

.gate p.gate-desc {
  margin-top: 12px;
  font-size: 0.86rem;
  line-height: 1.8;
  color: var(--paper-muted);
}

.gate-note {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 3px;
  background: rgba(217, 165, 102, 0.1);
  border: 1px solid rgba(217, 165, 102, 0.24);
  font-size: 0.78rem;
  line-height: 1.7;
  color: rgba(247, 243, 236, 0.72);
}

/* ---------- forms ---------- */
.field {
  display: block;
  margin-top: 18px;
}

.field > span {
  display: block;
  margin-bottom: 7px;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: rgba(247, 243, 236, 0.52);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--paper);
  background: rgba(15, 13, 12, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.field textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.8;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(15, 13, 12, 0.8);
}

.field select option {
  background: #1c1917;
  color: var(--paper);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-message {
  margin-top: 16px;
  font-size: 0.84rem;
  line-height: 1.7;
  min-height: 1.4em;
}

.form-message.is-error {
  color: #e88a7a;
}

.form-message.is-ok {
  color: #9dc99a;
}

/* ---------- admin editor ---------- */
.editor {
  margin-top: clamp(26px, 3.4vw, 38px);
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(247, 243, 236, 0.025);
}

.editor h2 {
  font-family: var(--ff-serif);
  font-weight: 300;
  font-size: clamp(1.1rem, 2vw, 1.34rem);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.editor-hint {
  font-size: 0.82rem;
  color: var(--paper-muted);
}

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.86rem;
  color: rgba(247, 243, 236, 0.76);
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  margin: 0;
}

/* ---------- admin list ---------- */
.admin-list {
  margin-top: clamp(30px, 4vw, 44px);
}

.admin-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-list-head h2 {
  font-family: var(--ff-serif);
  font-weight: 300;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.admin-list-head span {
  font-size: 0.78rem;
  color: rgba(247, 243, 236, 0.42);
}

.admin-rows {
  border-top: 1px solid var(--line);
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid rgba(255, 250, 242, 0.08);
}

.admin-row-main {
  min-width: 0;
}

.admin-row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.94rem;
  color: rgba(247, 243, 236, 0.9);
  word-break: break-word;
}

.badge-mini {
  flex: none;
  padding: 2px 9px;
  border-radius: 100px;
  border: 1px solid var(--line-strong);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: rgba(247, 243, 236, 0.56);
}

.badge-mini.is-public {
  border-color: rgba(217, 165, 102, 0.5);
  color: var(--accent);
}

.admin-row-sub {
  margin-top: 5px;
  font-size: 0.76rem;
  color: rgba(247, 243, 236, 0.4);
  word-break: break-word;
}

.admin-row-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.icon-btn {
  padding: 7px 13px;
  border-radius: 100px;
  border: 1px solid var(--line-strong);
  font-size: 0.76rem;
  color: rgba(247, 243, 236, 0.76);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.icon-btn:hover {
  border-color: var(--paper);
  color: var(--paper);
}

.icon-btn.is-danger:hover {
  background: #5a2621;
  border-color: #8a3a32;
  color: #ffd9d2;
}

.admin-empty {
  padding: 34px 0;
  text-align: center;
  font-size: 0.86rem;
  color: rgba(247, 243, 236, 0.4);
}

/* image preview inside editor */
.cover-preview {
  margin-top: 10px;
  display: none;
  width: 100%;
  max-width: 260px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  overflow: hidden;
  background: #14110f;
}

.cover-preview.is-visible {
  display: block;
}

.cover-preview img {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .detail-panel {
    max-height: 92vh;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (max-width: 560px) {
  .board-toolbar {
    align-items: flex-start;
  }

  .admin-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .admin-row-actions {
    justify-content: flex-start;
  }

  .detail-content {
    padding: 20px 18px 26px;
  }

  .gate {
    padding: 22px 18px;
  }
}
