/* PCS School look (see DESIGN.md), with the iPhone app treatment the other PCS apps use. */
:root {
  --crimson: #BD2041; --crimson-dk: #8E1530; --crimson-soft: #FBECEF;
  --bg: #FAF7F2; --surface: #FFFFFF; --gray-soft: #F1ECE4; --line: #E8E1D6;
  --muted: #6B6560; --ink: #1E1A18; --rose: #E8506E; --icon-tint: #F6E9EC;
  --warn: #9A6408; --bad: #B3261E;
  --se: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sa: "Libre Franklin", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --r-card: 18px; --r-btn: 12px;
  --shadow: 0 4px 18px rgba(80, 40, 30, .07);
  --bar-h: 76px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--sa); touch-action: manipulation;
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right)); }
h1, h2 { font-family: var(--se); font-weight: 700; line-height: 1.1; margin: 0; }

/* Top bar: charcoal, sticky, 3px crimson line, crest in a white circle */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff; border-bottom: 3px solid var(--crimson);
  padding-top: env(safe-area-inset-top); }
.topbar-in { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
.topbar img { width: 40px; height: 40px; border-radius: 50%; background: #fff; padding: 2px; border: 2px solid #fff; flex: none; }
.topbar b { display: block; font: 700 1.4rem/1 var(--se); }
.topbar small { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; opacity: .85; margin-top: 2px; }

/* Title band: charcoal, crest at 8% on the right, one italic word in Rose */
.band { position: relative; overflow: hidden; background: var(--ink); color: #fff; padding: 28px 0 30px; }
.band-crest { position: absolute; right: -30px; top: 50%; width: 220px; height: 220px; transform: translateY(-50%); opacity: .08; pointer-events: none; }
.band .wrap { position: relative; }
.band h1 { font-size: 2.1rem; margin: 6px 0 8px; }
.band h1 em { font-style: italic; font-weight: 600; color: var(--rose); }
.band p { margin: 0; opacity: .9; }
.band .kicker-rose { font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--rose); opacity: 1; }

.step { margin: 26px 0; }
.step h2 { font-size: 1.75rem; margin-bottom: 10px; }
.kicker { margin: 0 0 4px; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--crimson); }

/* Cards: white, 18px corners, the one warm shadow, no border */
.card, .panel { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 18px 16px; margin: 12px 0; }
label { display: block; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
input, textarea { width: 100%; min-height: 50px; padding: 11px 14px; font: 400 17px/1.4 var(--sa); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-btn); -webkit-appearance: none; appearance: none; }
input[type=date] { min-height: 50px; }
textarea { min-height: 110px; resize: vertical; }
:focus-visible { outline: 3px solid var(--crimson); outline-offset: 2px; }

/* Buttons: 48px+ tall, 12px corners, crimson is the only fill */
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1 1 200px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; font: 600 1rem var(--sa);
  border: 0; border-radius: var(--r-btn); cursor: pointer; transition: transform .12s, background .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--crimson); color: #fff; }
.btn.primary:hover { background: var(--crimson-dk); }
.btn.quiet { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.btn.link { background: var(--crimson-soft); color: var(--crimson); }
.btn.small { min-height: 48px; padding: 0 16px; font-weight: 600; }
.btn.danger { background: var(--surface); color: var(--bad); box-shadow: var(--shadow); }
.btn svg { width: 22px; height: 22px; fill: none; stroke: var(--crimson); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.muted { color: var(--muted); margin: 12px 0 0; }
.note { margin: 10px 0 0; color: var(--muted); }
.note:empty { display: none; }

/* Source cards */
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-head strong { overflow-wrap: anywhere; font-size: .95rem; }
.grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 620px) { .grid { grid-template-columns: 1fr 1fr; } .grid .wide { grid-column: 1 / -1; } }
.author-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.hint { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-btn); background: var(--gray-soft); color: var(--warn); font-size: .95rem; }
.hint:empty { display: none; }

/* iOS-style segmented control */
.seg { display: flex; background: var(--gray-soft); border-radius: var(--r-btn); padding: 4px; gap: 4px; margin: 12px 0 4px; }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 .95rem var(--sa); cursor: pointer; transition: background .15s, color .15s; }
.seg button[aria-pressed=true] { background: var(--crimson); color: #fff; }

/* The finished page keeps real MLA formatting (Times New Roman, double spaced) so it looks like what they will hand in */
.paper { background: #fff; border-radius: var(--r-card); box-shadow: var(--shadow); padding: 22px 18px; font-family: "Times New Roman", Times, serif; font-size: 1.05rem; line-height: 1.95; overflow-wrap: anywhere; }
.wc-heading { text-align: center; font-weight: 400; font-size: 1.1rem; margin: 0 0 12px; font-family: inherit; }
.wc-entry { margin: 0; padding-left: 2em; text-indent: -2em; }

/* Sign-in gate: nothing but the gate shows until an allowed account is signed in */
body:not([data-auth="in"]) .gated { display: none !important; }
body[data-auth="in"] .gate { display: none; }
.gate { min-height: calc(100vh - 140px); display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 28px 22px; text-align: center; }
.gate-card img { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; display: block; }
.gate-card h2 { font-size: 1.75rem; margin-bottom: 8px; }
.gate-card p { color: var(--muted); margin: 0 0 18px; }
.gate-card .btn { width: 100%; }
.gate-card .btn + .btn { margin-top: 10px; }
.topbtn { margin-left: auto; min-height: 48px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .35); border-radius: var(--r-btn); background: transparent; color: #fff; font: 600 .9rem var(--sa); cursor: pointer; }
.topbtn[hidden] { display: none; }

/* Bottom action bar: blurred, pinned above the iPhone home indicator */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; gap: 10px; justify-content: center;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); border-top: 1px solid var(--line); }
.actionbar[hidden] { display: none; }
.actionbar .btn { flex: 1; max-width: 360px; white-space: nowrap; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + 14px + env(safe-area-inset-bottom)); z-index: 50; margin: 0;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: .95rem; text-align: center; }
.toast:empty { display: none; }

.foot { color: var(--muted); font-size: .9rem; padding-bottom: 28px; }
@media (min-width: 700px) { .band h1 { font-size: 3rem; } .band-crest { right: 40px; width: 280px; height: 280px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
