/* ============================================================
   AdmissionPrep · Advisor Prep · v2
   Editorial prep memo aesthetic
   ============================================================ */

:root {
  /* Brand */
  --green:           #0B3D2E;
  --green-deep:      #072B20;
  --green-soft:      #F0F7F4;
  --green-soft-rule: #CDE0D9;

  /* Surface */
  --cream:           #F5F1E8;
  --cream-warm:      #EFE9D8;
  --white:           #FFFFFF;
  --paper:           #FBF8F1;

  /* Type */
  --text:            #1C1C1C;
  --text-soft:       #2D2D2D;
  --muted:           #6B6B6B;
  --muted-strong:    #4A4A4A;

  /* Lines */
  --border:          #E4DED3;
  --border-strong:   #C9C2B2;
  --tag-bg:          #EAE7DC;

  /* Status */
  --warn-bg:         #FAEFD9;
  --warn-border:     #D9B26E;
  --warn-text:       #7A4A0E;
  --error-bg:        #F8E5DF;
  --error-border:    #D3A498;
  --error-text:      #6B2920;

  /* Radius */
  --r-panel:         14px;
  --r-card:          12px;
  --r-pill:          999px;
  --r-button:        8px;

  /* Type scale */
  --serif:           'Libre Caslon Text', 'Caslon', Georgia, 'Times New Roman', serif;
  --sans:            'Open Sans', 'Helvetica Neue', system-ui, sans-serif;

  /* Shadows */
  --shadow-rise:     0 4px 14px rgba(11, 61, 46, 0.10);
  --shadow-press:    0 1px 3px rgba(11, 61, 46, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  /* Faint paper grain — gives the cream depth without noise */
  background-image:
    radial-gradient(circle at 18% 14%, rgba(11,61,46,0.030), transparent 22%),
    radial-gradient(circle at 82% 38%, rgba(11,61,46,0.024), transparent 20%),
    radial-gradient(circle at 50% 88%, rgba(11,61,46,0.018), transparent 28%);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "onum";
}

a { color: inherit; }

.hidden { display: none !important; }

/* ============================================================
   FOLIO — magazine-style header strip
   ============================================================ */

.folio {
  background: var(--green);
  color: var(--white);
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--green-deep);
}

.folio-left,
.folio-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.folio-divider {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.25);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
  letter-spacing: 0;
  text-transform: none;
}

.wordmark-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--white);
  color: var(--green);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.wordmark-name {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.folio-section {
  letter-spacing: 0.06em;
  font-weight: 600;
  opacity: 0.78;
}

.folio-date {
  letter-spacing: 0.06em;
  opacity: 0.78;
}

.folio-credit {
  background: rgba(255, 255, 255, 0.10);
  padding: 6px 14px;
  border-radius: var(--r-pill);
  letter-spacing: 0.06em;
  font-weight: 600;
}

.folio-credit.is-low {
  background: var(--warn-bg);
  color: var(--warn-text);
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */

.prep {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 40px 64px;
}

/* ============================================================
   HERO — magazine title block
   ============================================================ */

.prep-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 48px;
  margin-bottom: 22px;
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.05s both;
}

.hero-identity {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.hero-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--cream), 0 0 0 5px var(--green);
}

.hero-text { min-width: 0; flex: 1; }

.student-name {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.012em;
  margin: 0 0 14px;
  color: var(--text);
}

.first-badge {
  display: inline-block;
  vertical-align: middle;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--green);
  color: var(--white);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  margin-left: 14px;
  position: relative;
  top: -4px;
}

.student-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pill {
  font-family: var(--sans);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--tag-bg);
  color: var(--text);
  white-space: nowrap;
}

.pill-brand {
  background: var(--green);
  color: var(--white);
}

.pill-email {
  background: var(--tag-bg);
  color: var(--muted-strong);
  text-transform: none;
  letter-spacing: 0.01em;
  font-weight: 500;
  font-size: 11.5px;
}

.pill-targets {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
  text-transform: none;
  letter-spacing: 0.01em;
  font-weight: 600;
  font-size: 11.5px;
}

.alt-emails {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--sans);
  font-style: italic;
}

.alt-emails-label {
  font-style: normal;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 8px;
  color: var(--muted);
  position: relative;
  top: -1px;
}

.hero-stats {
  text-align: right;
  flex-shrink: 0;
  padding-top: 6px;
}

.stat-number {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  color: var(--green);
  line-height: 0.98;
  display: block;
  letter-spacing: -0.02em;
  font-variant-numeric: oldstyle-nums;
}

.stat-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 8px;
}

.stat-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-family: var(--sans);
}

/* ============================================================
   ACTION BUTTONS — outline-quiet, hunter-fill on primary
   ============================================================ */

.prep-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.18s both;
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.02em;
}

/* Decorative glyph from R3q is now hidden, kept for legacy markup. */
.action-glyph {
  display: none;
}

.action:hover {
  background: var(--cream-warm);
  color: var(--text);
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: var(--shadow-press);
}

.action-primary {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
  font-weight: 600;
}

.action-primary:hover {
  background: var(--green-deep);
  border-color: var(--green-deep);
  color: var(--white);
}

.action-ghost {
  background: transparent;
  border-color: var(--error-border);
  color: var(--error-text);
  font-size: 12px;
}

.action-ghost:hover {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: var(--error-border);
}

/* ============================================================
   RULE ORNAMENT — editorial section break
   ============================================================ */

.rule {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 36px 0 32px;
  position: relative;
  overflow: visible;
}

/* R3r: diamond ornament removed. `.rule-ornament` now renders as a plain
   hairline. Class kept for backward compat with existing markup. */
.rule-ornament::after {
  content: none;
}

/* ============================================================
   CONTEXT GRID
   ============================================================ */

.prep-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 44px;
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.32s both;
}

.col-main,
.col-side {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

/* Subtle vertical column rule, only on wide screens */
@media (min-width: 1100px) {
  .prep-grid {
    position: relative;
  }
  .prep-grid::before {
    content: "";
    position: absolute;
    left: calc(60.78% - 22px);   /* approximate 1.55fr split midline, gap 44px */
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--border);
    pointer-events: none;
  }
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  position: relative;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-label {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

.card-flag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* R3r: dot kept static; constant pulse read as editorial, not functional. */
.card-flag .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

.card-flag-muted {
  color: var(--muted);
}

.card-count {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted-strong);
  font-variant-numeric: oldstyle-nums;
}

/* Quote card — AI summary */

.card-quote {
  background: var(--green-soft);
  border-left: 2px solid var(--green);
  padding: 20px 24px 22px;
  border-radius: 0 var(--r-card) var(--r-card) 0;
}

.card-quote .card-label {
  color: var(--green);
}

.ai-content {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.68;
  color: var(--green-deep);
}

.ai-content p {
  margin: 0 0 14px;
}

.ai-content p:first-child::first-letter {
  font-size: 1.0em;
  font-weight: 700;
}

.ai-content p:last-child {
  margin-bottom: 0;
}

.ai-content strong {
  font-weight: 700;
  color: #061d15;
}

.ai-content ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.ai-content ul li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
}

.ai-content ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--green);
  font-weight: 600;
}

.card-meta {
  font-family: var(--sans);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 20px 0 0;
  font-style: normal;
  border-top: 1px solid var(--green-soft-rule);
  padding-top: 14px;
}

/* Tasks card */

.card-tasks {
  /* unstyled body; typography does the work */
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border);
}

.task-list li {
  position: relative;
  padding: 14px 0 14px 28px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-soft);
}

.task-list li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 18px;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--green);
  border-radius: 2px;
}

.task-list li:hover::before {
  background: var(--green);
}

/* Context (today's context) */

.card-context {
  background: var(--white);
  border: 1px solid var(--border);
  padding: 20px 22px;
  border-radius: var(--r-card);
}

.qa-list { margin: 0; }

.qa-list dt {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  margin: 0 0 5px;
}

.qa-list dd {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 18px;
  color: var(--text);
}

.qa-list dd:last-child { margin-bottom: 0; }

.card-context-empty .qa-meta {
  font-family: var(--serif);
  font-size: 16px;
  margin: 0 0 8px;
}

.card-context-empty .qa-empty {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

/* School list */

.card-schools .school-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border);
}

.school-list li {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.school-list li:last-child { border-bottom: 0; }

.school-rank {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.04em;
  font-variant-numeric: lining-nums;
  width: 22px;
  flex-shrink: 0;
  opacity: 0.55;
}

.school-name {
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--text);
}

/* Plan card — pull-quote treatment */

.card-plan {
  border-left: 2px solid var(--green);
  padding: 4px 0 6px 22px;
}

.plan-body {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--green-deep);
  font-style: italic;
  margin: 0;
}

/* ============================================================
   SESSION HISTORY
   ============================================================ */

.history-header {
  margin-bottom: 8px;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-list li { margin: 0; }

.history-list details {
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.history-list details:first-child { border-top: 1px solid var(--border); }

.history-list summary {
  cursor: pointer;
  display: grid;
  grid-template-columns: 96px 1fr 24px;
  align-items: center;
  gap: 18px;
  list-style: none;
  padding: 16px 0;
  transition: background 0.15s ease;
}

.history-list summary::-webkit-details-marker { display: none; }
.history-list summary::marker { display: none; }

.history-list summary:hover { background: rgba(11, 61, 46, 0.025); }

.history-date {
  font-family: var(--sans);
  font-weight: 700;
  color: var(--green);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.history-snippet {
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.45;
}

.history-affordance {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--muted);
  text-align: right;
  font-weight: 300;
  transition: transform 0.2s ease, color 0.2s ease;
  line-height: 1;
}

.history-list details[open] .history-affordance {
  transform: rotate(45deg);
  color: var(--green);
}

.history-detail {
  margin: 0 0 22px 96px;
  padding: 14px 0 14px 22px;
  border-left: 2px solid var(--green-soft-rule);
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-soft);
}

/* ============================================================
   FOOTER
   ============================================================ */

.prep-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.prep-footer-mark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--green);
  color: var(--white);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* ============================================================
   ERROR BANNER
   ============================================================ */

.error-banner {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  padding: 14px 18px;
  border-radius: var(--r-card);
  margin-bottom: 28px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.error-banner strong { color: var(--error-text); margin-right: 6px; }
.error-detail { color: var(--error-text); }

/* ============================================================
   SKELETON (loading)
   ============================================================ */

.skeleton {
  display: block;
  background: linear-gradient(
    90deg,
    var(--border) 0%,
    var(--paper) 50%,
    var(--border) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 4px;
  height: 1em;
}

.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-line-lg { height: 30px; margin-bottom: 16px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.85); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
  .prep-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .col-side {
    gap: 28px;
  }
}

@media (max-width: 900px) {
  .folio {
    padding: 12px 24px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .folio-section { display: none; }
  .folio-right { gap: 12px; flex-wrap: wrap; }
  .folio-credit { font-size: 10.5px; padding: 4px 10px; }

  .prep { padding: 36px 24px 64px; }

  .prep-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }
  .hero-stats { text-align: left; }
  .student-name { font-size: 26px; }
  .stat-number { font-size: 36px; }
  .first-badge { display: inline-block; margin-left: 0; margin-top: 8px; top: 0; }

  .rule { margin: 36px 0 28px; }

  .history-list summary {
    grid-template-columns: 1fr 24px;
    row-gap: 6px;
  }
  .history-date { grid-row: 1; }
  .history-affordance { grid-row: 1; }
  .history-snippet { grid-column: 1 / 3; grid-row: 2; }
  .history-detail { margin-left: 0; }
}

@media (max-width: 540px) {
  .student-pills .pill { font-size: 10px; padding: 3px 8px; }
  .prep-actions .action { font-size: 12px; padding: 7px 11px; }
  .ai-content { font-size: 15.5px; }
  .school-list li { gap: 10px; }
}

/* ============================================================
   PRINT — should genuinely look like a print memo
   ============================================================ */

@media print {
  body { background: white; }
  .folio { background: white; color: var(--text); border-bottom: 2px solid var(--green); }
  .folio-credit { background: transparent; }
  .prep-actions, .error-banner { display: none; }
  .card-quote { background: white; border-left: 3px solid var(--green); }
  .prep-history { page-break-before: always; }
}
