/* oatrealm.com — Office of Residency
   Based on the approved design reference (light + dark).
   IBM Plex fonts are self-hosted by scripts/build.mjs. */

:root,
[data-theme="light"] {
  --page:         #f5eedf; /* Silled Scroll --paper */
  --sheet:        #fbf7ee; /* --paper-raised */
  --sheet-alt:    #f1e9d8;
  --sheet-shadow: #f3ebda;
  --field:        #fffdf8;
  --ink:          #1c2230; /* --ink */
  --ink-2:        #353a48;
  --muted:        #4e5363; /* --ink-soft */
  --line:         #cfc4ae; /* --rule-soft */
  --primary:      #1c2230; /* buttons + links: ink, like an office stamp pad */
  --stamp:        #a54926; /* --accent-text */
  --placeholder:  #757063;
  --disabled:     #ecd9cd;
  color-scheme: light;
}
[data-theme="dark"] {
  --page:         #1a1512; /* Silled Scroll dark --paper */
  --sheet:        #231c17; /* --paper-raised */
  --sheet-alt:    #2b231d; /* --hatch */
  --sheet-shadow: #1e1814;
  --field:        #17120f;
  --ink:          #f0e6d4;
  --ink-2:        #d9ceba;
  --muted:        #b9ad99; /* --ink-soft */
  --line:         #3e342b; /* --rule-soft */
  --primary:      #f0e6d4;
  --stamp:        #ee8f6b; /* --accent-text */
  --placeholder:  #8f8474;
  --disabled:     #3f2e26;
  color-scheme: dark;
}

:root {
  --serif: 'IBM Plex Serif', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;
}

* { box-sizing: border-box; }
html { background: var(--page); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--page); color: var(--ink); font-family: var(--sans); }
a { color: var(--primary); }
a:hover { color: var(--stamp); }
:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
input::placeholder { color: var(--placeholder); }

/* ---------- layout ---------- */
.container { width: 100%; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.container--wide { max-width: 1100px; }
.container--mid { max-width: 900px; }
.container--form { max-width: 640px; }
.container--tfa { max-width: 720px; }
.container--narrow { max-width: 528px; }

/* ---------- notice strip ---------- */
.notice { background: var(--sheet); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--muted); text-align: center; padding: 10px 16px; }

/* ---------- header ---------- */
.site-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding-top: 28px; }
.brand { display: flex; align-items: center; gap: 20px; }
.brand__text { display: flex; flex-direction: column; gap: 2px; }
.brand__name { font-family: var(--serif); font-weight: 600; font-size: 24px; color: var(--ink); text-decoration: none; }
.brand__sub { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; color: var(--muted); }
.header-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; font-family: var(--mono); font-size: 13px; }
.header-nav a { padding: 12px 0; }

/* ---------- stamps (inline SVG, rotation baked in, colour from currentColor) ---------- */
.stamp { display: block; flex: none; color: var(--stamp); }
.stamp--ok { color: var(--primary); }

/* ---------- typography ---------- */
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--stamp); }
.kicker--muted { color: var(--muted); }
.title { margin: 0; font-family: var(--serif); font-weight: 600; line-height: 1.08; font-size: clamp(34px, 5vw, 46px); }
.title--hero { font-size: clamp(40px, 6vw, 60px); line-height: 1.05; }
.title--sheet { font-size: 34px; line-height: 1.1; }
.title--small { font-size: 30px; line-height: 1.15; }
.lead { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink-2); max-width: 56ch; }
.lead--hero { font-size: 17px; max-width: 44ch; }
.aside { margin: 0; font-family: var(--mono); font-style: italic; font-size: 13px; line-height: 1.6; color: var(--muted); max-width: 52ch; }

/* ---------- sheet (paper form) ---------- */
.sheet { background: var(--sheet); border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line), 0 3px 0 var(--sheet-shadow), 0 4px 0 var(--line); }
.sheet--flat { box-shadow: none; }
.sheet__strip { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 28px; border-bottom: 1px solid var(--ink); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.sheet__strip--danger { border-bottom-color: var(--stamp); color: var(--stamp); }
.sheet__body { padding: 28px 28px 8px; display: flex; flex-direction: column; }
.sheet__body--gap { gap: 18px; padding-bottom: 28px; }
.sheet__stub { padding: 14px 28px; border-top: 2px dashed var(--line); background: var(--sheet-alt); font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--muted); }

/* numbered form section: "§1 | content" */
.sec { display: grid; grid-template-columns: 44px minmax(0, 1fr); border-top: 1px solid var(--line); padding: 16px 0; }
.sec--roomy { padding: 20px 0; }
.sheet__body > .sec:first-child { border-top: 0; }
.sec__no { font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 1px; }
.sec__body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sec__split { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.label { margin: 0; font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .06em; color: var(--muted); }
.value { font-size: 17px; font-weight: 500; }
.note { font-family: var(--mono); font-style: italic; font-size: 12px; color: var(--muted); }
.list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.5; }

/* ---------- fields ---------- */
.input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 2px; background: var(--field); font: inherit; font-size: 16px; color: var(--ink); }
.input--code { height: 60px; font-family: var(--mono); font-size: 28px; letter-spacing: .4em; }
.input--code-sm { max-width: 260px; height: 56px; font-family: var(--mono); font-size: 26px; letter-spacing: .4em; }
.input--mono { font-family: var(--mono); letter-spacing: .1em; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.label-row a { font-size: 13px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 52px; padding: 0 26px; border: 0; border-radius: 2px; font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: .04em; text-decoration: none; cursor: pointer; }
.btn--primary { background: var(--primary); color: var(--sheet); }
.btn--primary:hover { color: var(--sheet); opacity: .9; }
.btn--block { width: 100%; }
.btn--ghost { height: 48px; padding: 0 16px; border: 1px solid var(--ink); background: var(--sheet-alt); color: var(--ink); font-size: 13px; font-weight: 400; letter-spacing: 0; }
.btn--ghost:hover { color: var(--ink); }
.btn--outline { border: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: 14px; font-weight: 400; letter-spacing: 0; padding: 0 20px; }
.btn--outline:hover { color: var(--ink); }
.btn--sm { height: 46px; padding: 0 18px; font-size: 14px; }
.btn--danger { background: var(--stamp); color: var(--sheet); }
.btn--danger-outline { border: 1px solid var(--stamp); background: transparent; color: var(--stamp); }
.btn:disabled { background: var(--disabled); color: var(--muted); cursor: not-allowed; opacity: 1; }
.actions { border-top: 1px solid var(--ink); padding: 20px 0 24px; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px; }

/* ---------- home ---------- */
.hero { display: flex; flex-wrap: wrap; gap: 56px; align-items: flex-start; padding-top: 56px; padding-bottom: 48px; }
.hero__text { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 20px; padding-top: 8px; }
.hero__form { flex: 1 1 380px; max-width: 460px; min-width: 0; }
.directory { padding-bottom: 56px; }
.directory .sheet__body { padding: 4px 28px 8px; font-size: 15px; }
.dir-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.dir-row:last-child { border-bottom: 0; }
.dir-row__no { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.dir-row__status { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--muted); }
.dir-row a { font-family: var(--mono); font-size: 13px; font-weight: 600; padding: 8px 0; }
.dim { color: var(--muted); }

/* ---------- account ---------- */
.page { padding-top: 40px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 32px; }
.page--form { padding-top: 48px; }
.page-head { display: flex; flex-direction: column; gap: 10px; }
.apps { border-top: 1px solid var(--ink); }
.app-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.app-row__name { font-family: var(--serif); font-weight: 600; font-size: 18px; }
.app-row__desc { font-size: 13px; color: var(--muted); }
.app-row a { font-family: var(--mono); font-size: 13px; font-weight: 600; padding: 10px 0; }
.danger-row { padding: 22px 28px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.danger-row__text { display: flex; flex-direction: column; gap: 6px; flex: 1 1 360px; min-width: 0; }
.danger-row h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 22px; }
.danger-row p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-2); }

/* ---------- 2FA setup ---------- */
.qr-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.qr { width: 168px; height: 168px; flex: none; border: 1px dashed var(--muted); background: var(--field); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.qr-row__side { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.qr-row__side p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.key { flex: 1; min-width: 0; display: flex; align-items: center; height: 46px; padding: 0 12px; border: 1px solid var(--line); background: var(--sheet-alt); font-family: var(--mono); font-size: 14px; letter-spacing: .08em; overflow-x: auto; white-space: nowrap; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; padding: 14px 16px; border: 1px dashed var(--line); background: var(--sheet-alt); font-family: var(--mono); font-size: 14px; color: var(--muted); }

/* ---------- result states ---------- */
.result { padding: 44px 28px 40px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; }
.result .title { font-size: 32px; line-height: 1.15; margin-top: 8px; }
[hidden] { display: none !important; }

/* ---------- footer ---------- */
.site-footer { margin-top: auto; }
.site-footer__inner { padding-top: 20px; padding-bottom: 28px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted);
  background: linear-gradient(var(--line), var(--line)) 24px 0 / calc(100% - 48px) 1px no-repeat; }
.site-footer nav { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.theme-toggle { height: 36px; padding: 0 12px; border: 1px solid var(--ink); border-radius: 2px; background: var(--sheet-alt); color: var(--ink); font-family: var(--mono); font-size: 12px; letter-spacing: .06em; cursor: pointer; }

@media (max-width: 560px) {
  .sheet__strip, .sheet__body, .sheet__stub, .danger-row, .directory .sheet__body { padding-left: 20px; padding-right: 20px; }
  .dir-row { grid-template-columns: minmax(0, 1fr) auto; }
  .dir-row__no { grid-column: 1 / -1; }
  .actions .btn { flex: 1 1 auto; }
}
