/* Dr. Owais Akram Farooqui — "The Quarter-Century Spine".
   Bone paper, coffee-black ink, copper accent, steel-blue secondary.
   A left timeline spine carries six entries of a practice record; on
   small screens the spine folds away into a stacked record.
   System stacks only — this site works offline. Layered cascade. */
@layer base, components;

@layer base {
  :root {
    color-scheme: light;
    --bone: #efe9dd;
    --coffee: #221c17;
    --copper: #9c5b2e;
    --steel: #4a657a;
    --ink-soft: color-mix(in srgb, var(--coffee) 62%, transparent);
    --line: color-mix(in srgb, var(--coffee) 18%, transparent);
    --card: color-mix(in srgb, var(--bone) 93%, white 7%);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --bone: #1e1812;
      --coffee: #e9dfcd;
      --copper: #c98f59;
      --steel: #93aabd;
    }
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bone: #1e1812;
    --coffee: #e9dfcd;
    --copper: #c98f59;
    --steel: #93aabd;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bone);
    color: var(--coffee);
    font: 16px/1.65 system-ui, "Segoe UI", sans-serif;
  }
  h1, h2, h3 {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-weight: 600;
    line-height: 1.18;
    margin: 0 0 12px;
  }
  h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); }
  a { color: var(--steel); }
  a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--copper);
    outline-offset: 2px;
  }
  section { scroll-margin-top: 96px; }
}

@layer components {
  .skip-link {
    position: absolute;
    inset-inline-start: -999px;
    &:focus { inset-inline-start: 12px; inset-block-start: 8px; background: var(--bone); padding: 6px 10px; }
  }

  /* ---- header: identity + entry index ---- */
  .spine-head {
    position: sticky;
    inset-block-start: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--bone) 88%, transparent);
    backdrop-filter: blur(6px);
    border-block-end: 1px solid var(--line);
  }
  .spine-identity {
    margin: 0;
    display: grid;
    line-height: 1.25;
    min-width: 0;
  }
  .spine-mark {
    font: 700 1.05rem Georgia, serif;
    letter-spacing: 0.04em;
    color: var(--copper);
  }
  .spine-mark-dot { color: var(--steel); }
  .spine-name {
    display: block;
    font-weight: 650;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .spine-cred { font-size: 0.72rem; text-decoration: none; color: var(--ink-soft); }
  .spine-sub { display: none; font-size: 0.78rem; color: var(--ink-soft); }
  @media (min-width: 720px) { .spine-sub { display: block; } }

  .index-nav {
    margin-inline-start: auto;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    &::-webkit-scrollbar { display: none; }
  }
  .index-link {
    display: grid;
    justify-items: center;
    padding: 6px 9px;
    font-size: 0.78rem;
    text-decoration: none;
    color: var(--ink-soft);
    border-block-end: 2px solid transparent;
    white-space: nowrap;
    &:hover { color: var(--coffee); }
    &[aria-current="true"] {
      color: var(--coffee);
      border-block-end-color: var(--copper);
    }
  }
  .index-no {
    font: 600 0.62rem/1 ui-monospace, Menlo, monospace;
    color: var(--steel);
    letter-spacing: 0.08em;
  }
  .index-link-book { color: var(--copper); font-weight: 600; }

  .theme-toggle {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--coffee);
    border-radius: 8px;
    padding: 7px;
    cursor: pointer;
    & .ic-moon { display: none; }
  }
  [data-theme="dark"] .theme-toggle {
    & .ic-sun { display: none; }
    & .ic-moon { display: block; }
  }

  /* ---- the spine: a record kept in order ---- */
  .spine-main {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 24px 90px;
  }
  .entry {
    position: relative;
    padding-block: 38px 6px;
  }
  .milestone {
    margin: 0 0 12px;
    font: 600 0.72rem/1.4 ui-monospace, Menlo, monospace;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--steel);
  }
  @media (min-width: 880px) {
    /* the spine itself */
    .spine-main {
      padding-inline-start: 216px;
      &::before {
        content: "";
        position: absolute;
        inset-block: 0;
        inset-inline-start: 156px;
        inline-size: 2px;
        background: var(--line);
      }
    }
    .entry > .milestone {
      position: absolute;
      inset-block-start: 42px;
      inset-inline-start: -214px;
      inline-size: 120px;
      margin: 0;
      text-align: end;
    }
    /* milestone diamond on the spine */
    .entry::before {
      content: "";
      position: absolute;
      inset-block-start: 44px;
      inset-inline-start: -66px;
      inline-size: 12px;
      block-size: 12px;
      rotate: 45deg;
      background: var(--copper);
      box-shadow: 0 0 0 5px var(--bone);
    }
    .entry-hero > .milestone { inset-block-start: 58px; }
    .entry-hero::before { inset-block-start: 60px; background: var(--bone); border: 2px solid var(--copper); }
    .entry-final::before { background: var(--steel); }
  }

  .entry-hero {
    padding-block: 54px 8px;
    & h1 { font-size: clamp(2rem, 5.6vw, 3.1rem); }
  }
  .hero-eyebrow {
    margin: 0 0 14px;
    font: 600 0.78rem/1.4 ui-monospace, Menlo, monospace;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--copper);
  }
  .hero-line { font-size: 1.14rem; margin: 0 0 10px; }
  .hero-note { color: var(--ink-soft); font-size: 0.92rem; }

  /* ---- practice ---- */
  .practice-list { padding-inline-start: 18px; display: grid; gap: 10px; }

  .spine-art {
    margin: 26px 0 0;
    & svg { width: min(340px, 82%); display: block; }
    & figcaption { font-size: 0.85rem; color: var(--ink-soft); font-style: italic; margin-block-start: 6px; }
  }
  .art-path { fill: none; stroke: var(--coffee); stroke-width: 4; stroke-linecap: round; }
  .art-branch { fill: none; stroke: var(--steel); stroke-width: 4; stroke-linecap: round; }
  .art-mark { fill: var(--copper); }

  /* ---- clinic ---- */
  .clinic-address {
    font-style: normal;
    border-inline-start: 3px solid var(--copper);
    padding: 6px 0 6px 16px;
    margin: 14px 0;
  }
  .clinic-note { color: var(--ink-soft); font-size: 0.92rem; }

  /* ---- the hour ---- */
  .hour-fee { font-weight: 600; }
  .hour-note { font-size: 0.88rem; color: var(--ink-soft); }

  /* ---- about ---- */
  .about-grid {
    display: grid;
    gap: 18px;
    @media (min-width: 640px) { grid-template-columns: 150px 1fr; }
  }
  .portrait-slot {
    display: grid;
    place-items: center;
    gap: 8px;
    align-content: center;
    border: 1px dashed var(--line);
    border-radius: 10px;
    min-height: 150px;
    padding: 12px;
  }
  .monogram {
    font: 700 2rem Georgia, serif;
    color: var(--copper);
    letter-spacing: 0.06em;
  }
  .portrait-note { font-size: 0.72rem; color: var(--ink-soft); text-align: center; }
  .about-sources { font-size: 0.86rem; color: var(--ink-soft); }

  /* ---- register ---- */
  .register-form {
    display: grid;
    gap: 8px;
    max-width: 480px;
  }
  .reg-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-block-start: 8px;
  }
  .reg-optional { font-weight: 400; color: var(--ink-soft); }
  .reg-field {
    font: inherit;
    min-width: 0; /* a long <option> must not force the grid past the viewport */
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: inherit;
  }
  .reg-field.invalid { border-color: var(--copper); }
  .reg-error { min-height: 1.2em; font-size: 0.88rem; color: var(--copper); }
  .reg-submit {
    justify-self: start;
    font: inherit;
    font-weight: 650;
    padding: 11px 24px;
    border-radius: 999px;
    border: 0;
    background: var(--copper);
    color: var(--bone);
    cursor: pointer;
    &:hover { filter: brightness(1.07); }
  }
  .reg-fallback { font-size: 0.9rem; color: var(--ink-soft); }

  /* ---- footer ---- */
  .spine-foot {
    border-block-start: 1px solid var(--line);
    padding: 22px 18px 40px;
    text-align: center;
  }
  .foot-rule { margin: 0 0 6px; font-size: 0.9rem; }
  .foot-note { margin: 0; font-size: 0.8rem; color: var(--ink-soft); max-width: 60ch; margin-inline: auto; }
}
