/* ============================================================
   About page — history timeline + education philosophy
   Matches the academy brochure layout. Accent comes from data-theme.
   ============================================================ */

.about-banner {
  /*
   * Shared height with .page-intro via --page-banner-* tokens.
   * Local aliases keep existing child selectors readable.
   */
  --banner-brand: var(--page-banner-brand);
  --banner-lead: var(--page-banner-lead);
  --banner-gap: var(--page-banner-gap);
  --banner-h: var(--page-banner-title-h);
  /* Same rail metrics as .timeline so the notch can sit on the spine */
  --timeline-date-w: 7.75rem;
  --timeline-rail-w: 1.25rem;
  --timeline-gap: 1.15rem;
  box-sizing: border-box;
  height: var(--page-banner-height);
  min-height: var(--page-banner-height);
  background-color: var(--color-bg-banner);
  color: var(--color-text-inverse);
  position: relative;
  display: flex;
  align-items: center;
  padding-block: var(--page-banner-pad-y);
  overflow: hidden;
}

/* Connected local-nav tabs need to paint past the banner edge */
.about-banner:has(.local-nav) {
  overflow: visible;
  z-index: 1;
  padding-block: 0;
}

.about-banner__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  height: 100%;
}

/* Nav left + “01” title block right — same pattern as results page-intro */
.about-banner__inner:has(.local-nav) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--spacing-xl);
  align-items: end;
}

.about-banner__inner:has(.local-nav) .local-nav {
  grid-column: 1;
  align-self: end;
}

.about-banner__inner:has(.local-nav) .about-banner__row {
  grid-column: 2;
  align-self: center;
  justify-content: flex-end;
  text-align: right;
}

.about-banner__row {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  width: 100%;
}

.about-banner__inner:has(.local-nav) .about-banner__title {
  align-items: flex-end;
}

/* Downward notch — default centered (mobile has no timeline rail) */
.about-banner::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 14px solid var(--color-bg-banner);
}

/* Connected tabs replace the notch cue */
.about-banner:has(.local-nav)::after {
  content: none;
}

/* Desktop: pin the notch to the timeline vertical rail center (history page only) */
@media (min-width: 768px) {
  .about-banner:not(:has(.local-nav))::after {
    left: calc(
      max(0px, (100% - var(--container-max)) / 2)
      + var(--container-padding)
      + var(--timeline-date-w)
      + var(--timeline-gap)
      + (var(--timeline-rail-w) / 2)
    );
  }
}

@media (max-width: 767px) {
  .about-banner__inner:has(.local-nav) {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-items: stretch;
    align-content: space-between;
    padding-block: var(--spacing-md) 0;
  }

  .about-banner__inner:has(.local-nav) .about-banner__row {
    grid-column: 1;
    grid-row: 1;
  }

  .about-banner__inner:has(.local-nav) .local-nav {
    grid-column: 1;
    grid-row: 2;
  }
}

.about-section {
  position: relative;
  /* Extra space below the shell before footer / next section */
  padding-block: var(--spacing-3xl) var(--spacing-4xl);
}

/* Content shell — full-width after nav moved into the banner */
.about-shell {
  position: relative;
}

.about-shell__main {
  width: 100%;
  min-width: 0;
}

.about-kicker {
  font-family: var(--font-gyeonggi-batang);
  font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: var(--spacing-xl);
}

.about-banner__title {
  font-family: var(--font-jalnan);
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: var(--letter-spacing-tight);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: var(--banner-h);
  margin: 0;
  line-height: 1;
}

/* First line smaller than the second */
.about-banner__brand {
  display: block;
  font-size: var(--banner-brand);
  line-height: 1;
}

.about-banner__lead {
  display: block;
  font-size: var(--banner-lead);
  line-height: 1;
}

/* ------------------------------------------------------------
   Timeline: date | rail (dot + connection bar) | title | body
   The rail column is a real grid cell that stretches with the
   row height, so the vertical bar never breaks between items.
   ------------------------------------------------------------ */
.timeline {
  --timeline-date-w: 7.75rem;
  --timeline-rail-w: 1.25rem;
  --timeline-gap: 1.15rem;
  --timeline-title-w: 19rem;
  --timeline-pad: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.timeline__item {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-xs);
  padding-bottom: var(--spacing-xl);
  position: relative;
}

/* Year rows cascade in order; decorative caps/rules are not .reveal */
.timeline > .timeline__item.reveal {
  opacity: 0;
  transform: translateY(18px);
}

.timeline > .timeline__item.reveal.is-visible {
  animation: fade-up var(--duration-slow) var(--ease-out) var(--reveal-delay, 0s) both;
}

.timeline__date {
  font-family: var(--font-jalnan);
  font-size: var(--font-size-lg);
  font-weight: 400;
  font-synthesis: none;
  color: var(--color-accent);
  margin: 0;
}

.timeline__title {
  font-family: var(--font-gyeonggi-batang);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.timeline__body {
  font-family: var(--font-gyeonggi-batang);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-secondary);
}

.timeline__body p {
  margin: 0;
}

.timeline__body p + p {
  margin-top: var(--spacing-sm);
}

/* Hide rail on mobile — dates / titles stack without the spine */
.timeline__mark {
  display: none;
}

.timeline__rule {
  border: 0;
  border-top: 1px dashed color-mix(in srgb, var(--color-accent) 45%, transparent);
  margin: var(--spacing-md) 0 var(--spacing-xl);
}

/* Inline dashed rule inside a continuous timeline (rail keeps running) */
.timeline__rule--inline {
  margin: 0;
  width: 100%;
}

.timeline--ended,
.timeline--started {
  margin-bottom: var(--spacing-xl);
}

@media (min-width: 768px) {
  .timeline__item {
    grid-template-columns:
      var(--timeline-date-w)
      var(--timeline-rail-w)
      minmax(14rem, var(--timeline-title-w))
      minmax(0, 1fr);
    column-gap: var(--timeline-gap);
    align-items: stretch;
    padding-bottom: var(--timeline-pad);
  }

  .timeline__date {
    text-align: right;
    padding-top: 0.15em;
    align-self: start;
    font-size: var(--font-size-xl);
  }

  /* Flatten title + body into the 4-column row */
  .timeline__copy {
    display: contents;
  }

  .timeline__title,
  .timeline__body {
    align-self: start;
    padding-top: 0.15em;
    font-size: var(--font-size-xl);
  }

  /* Long titles stay on one line in the widened title column */
  .timeline__title {
    white-space: nowrap;
  }

  /*
   * Rail column: block-level cell that stretches to the full row height.
   * The connection bar is drawn from the dot center down through the
   * padding so it meets the next item's dot with no gap.
   */
  .timeline__mark {
    display: block;
    position: relative;
    width: 100%;
    min-height: 1rem;
    justify-self: center;
  }

  /* Hollow circle marker, aligned with the first line of text */
  .timeline__mark::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0.35rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid var(--color-accent);
    transform: translateX(-50%);
    z-index: 2;
    box-sizing: border-box;
  }

  /*
   * Continuous connection bar: starts at this item's dot center and
   * extends through padding-bottom into the next item, stopping at the
   * next dot center (pad + 0.7rem) so there is no visible gap.
   */
  .timeline__mark::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0.7rem; /* center of the 12px dot at top 0.35rem */
    bottom: calc(-1 * (var(--timeline-pad) + 0.7rem));
    width: 2px;
    background-color: var(--color-accent);
    transform: translateX(-50%);
    z-index: 1;
  }

  /*
   * Mid-section dashed separator: no dot, vertical bar keeps running,
   * dashed line spans title + body columns (and behind the rail).
   */
  .timeline__item--rule {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    min-height: 1.25rem;
  }

  .timeline__item--rule .timeline__mark::after {
    display: none;
  }

  .timeline__item--rule .timeline__mark::before {
    top: 0;
    bottom: calc(-1 * (0.5rem + 0.7rem));
  }

  .timeline__item--rule .timeline__title,
  .timeline__item--endcap .timeline__title,
  .timeline__item--startcap .timeline__title {
    display: none;
  }

  .timeline__item--rule .timeline__body {
    /* Body only hosts the hr; line is painted full-bleed via absolute */
    display: none;
  }

  .timeline__item--rule .timeline__rule--inline {
    /* Full width across date + rail + content (not cut off at the rail) */
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    width: auto;
    z-index: 0;
  }

  .timeline__item--rule .timeline__mark {
    z-index: 1;
  }

  /* Tighten gap between last content row and the end-cap row */
  .timeline__item:has(+ .timeline__item--endcap) {
    padding-bottom: 0;
  }

  .timeline__item:has(+ .timeline__item--endcap) .timeline__mark::before {
    /* Meet the top of the end-cap rail exactly */
    bottom: 0;
  }

  /*
   * End cap (brochure):
   *   Continuous vertical rail drawn on the item (not the mark) from the
   *   top edge through the dashed rule, ending flush on the = ticks.
   */
  .timeline__item--endcap {
    --cap-stub: 2rem;
    --cap-tick-gap: 3px;
    --cap-tick-h: 2px;
    --cap-tick-w: 14px;
    --rail-x: calc(
      var(--timeline-date-w) + var(--timeline-gap) + (var(--timeline-rail-w) / 2)
    );
    padding-top: 0;
    padding-bottom: 0.85rem;
    min-height: calc(var(--cap-stub) + 0.85rem);
  }

  /* Disable mark pseudos — rail + ticks are painted on the item */
  .timeline__item--endcap .timeline__mark::before,
  .timeline__item--endcap .timeline__mark::after {
    content: none;
    display: none;
  }

  /* Vertical stub: top of end-cap → just above the = ticks */
  .timeline__item--endcap::before {
    content: "";
    position: absolute;
    left: var(--rail-x);
    top: 0;
    height: var(--cap-stub);
    width: 2px;
    background-color: var(--color-accent);
    transform: translateX(-50%);
    z-index: 1;
  }

  /* = ticks flush under the stub (1px overlap, no gap) */
  .timeline__item--endcap::after {
    content: "";
    position: absolute;
    left: var(--rail-x);
    top: calc(var(--cap-stub) - 1px);
    width: var(--cap-tick-w);
    height: calc(var(--cap-tick-h) * 2 + var(--cap-tick-gap));
    transform: translateX(-50%);
    border-top: var(--cap-tick-h) solid var(--color-accent);
    border-bottom: var(--cap-tick-h) solid var(--color-accent);
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    background: transparent;
    box-sizing: border-box;
    z-index: 2;
  }

  /* Dashed rule crosses the middle of the stub */
  .timeline__item--endcap .timeline__body {
    display: none;
  }

  .timeline__item--endcap .timeline__rule--inline {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(var(--cap-stub) / 2);
    margin: 0;
    width: auto;
    border: 0;
    border-top: 1px dashed color-mix(in srgb, var(--color-accent) 55%, transparent);
    z-index: 0;
  }

  /* Plain end cap (종합학원): stub + = only, no dashed rule */
  .timeline__item--endcap-plain {
    min-height: calc(var(--cap-stub) + 0.85rem);
  }

  .timeline__item--endcap-plain .timeline__rule--inline {
    display: none;
  }

  /*
   * Start cap (brochure): = ticks at the top; vertical line grows
   * downward from the bottom of the ticks (1px overlap) into the first entry.
   */
  .timeline__item--startcap {
    --cap-tick-gap: 3px;
    --cap-tick-h: 2px;
    --cap-tick-w: 14px;
    padding-top: 0.15rem;
    padding-bottom: 0.5rem;
    min-height: 2rem;
  }

  .timeline__item--startcap .timeline__mark {
    min-height: calc(var(--cap-tick-h) * 2 + var(--cap-tick-gap) + 1.25rem);
    overflow: visible;
  }

  .timeline__item--startcap .timeline__mark::after {
    display: block;
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    width: var(--cap-tick-w);
    height: calc(var(--cap-tick-h) * 2 + var(--cap-tick-gap));
    transform: translateX(-50%);
    border-top: var(--cap-tick-h) solid var(--color-accent);
    border-bottom: var(--cap-tick-h) solid var(--color-accent);
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    background: transparent;
    box-sizing: border-box;
    z-index: 2;
  }

  .timeline__item--startcap .timeline__mark::before {
    /* Stem starts 1px into the ticks so they visually meet */
    top: calc(var(--cap-tick-h) * 2 + var(--cap-tick-gap) - 1px);
    bottom: calc(-1 * (0.5rem + 0.7rem));
  }

  .timeline__item--startcap .timeline__body {
    display: none;
  }
}

/* Philosophy blocks */
/*
 * Layout:
 *  - Lead article + portrait share the top row (in-flow, scrolls with the page)
 *  - Later articles (.about-prose--wide) span the full layout width
 */
.about-prose-layout {
  display: grid;
  gap: var(--spacing-2xl);
  align-items: start;
}

.about-prose {
  min-width: 0;
}

.about-portrait {
  margin: 0;
  padding: 0;
  /* Let the PNG alpha show the page background — no fill behind the subject */
  background: transparent;
  justify-self: center;
  max-width: 14rem;
  width: 100%;
}

.about-portrait__sticky {
  /* Name kept for markup; no sticky — portrait stays in document flow */
  width: 100%;
}

.about-portrait img {
  display: block;
  width: 100%;
  height: auto;
  background: transparent;
  /* Keep full cutout (do not crop transparent edges) */
  object-fit: contain;
  object-position: center top;
  /* Display portrait in black and white */
  filter: grayscale(100%);
}

.about-portrait__caption {
  margin-top: var(--spacing-sm);
  font-family: var(--font-gyeonggi-batang);
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text-primary);
  text-align: center;
  letter-spacing: 0.02em;
}

@media (min-width: 1024px) {
  .about-prose-layout {
    grid-template-columns: minmax(0, 1fr) 15rem;
    column-gap: var(--spacing-xl);
    row-gap: var(--spacing-2xl);
    /* Fill the site container (--container-max) */
    max-width: none;
    width: 100%;
  }

  /* First article + portrait share row 1 only (document position, not viewport) */
  .about-prose--lead {
    grid-column: 1;
    grid-row: 1;
  }

  .about-portrait {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    justify-self: end;
    max-width: none;
    width: 15rem;
    /* Nudge portrait slightly down relative to the lead prose */
    margin-top: var(--spacing-lg);
  }

  /* Mind + system: full layout width */
  .about-prose--wide {
    grid-column: 1 / -1;
    box-sizing: border-box;
    width: 100%;
  }
}

.about-prose__title {
  font-family: var(--font-gyeonggi-batang);
  /* Section titles — larger than body for clear hierarchy */
  font-size: clamp(var(--font-size-2xl), 2.4vw, var(--font-size-3xl));
  font-weight: 700;
  color: var(--color-accent);
  padding-left: var(--spacing-md);
  border-left: 4px solid var(--color-accent);
  margin-bottom: var(--spacing-md);
  line-height: var(--line-height-tight);
}

.about-prose__body {
  font-family: var(--font-gyeonggi-batang);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-secondary);
}

@media (min-width: 768px) {
  .about-prose__body {
    font-size: var(--font-size-xl);
  }
}

.about-prose__body p + p {
  margin-top: var(--spacing-md);
}

.about-prose__body strong {
  color: var(--color-accent-dark);
  font-weight: var(--font-weight-semibold);
}

/* Brochure-style yellow highlighter on key phrases */
.about-prose__hl {
  background-color: var(--color-highlight);
  color: inherit;
  font-weight: var(--font-weight-bold);
  padding: 0.05em 0.15em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
