/*
 * therealmshelf.app — the one stylesheet.
 *
 * ONE file, and no inline styles anywhere on the site: the Content-Security-
 * Policy in /_headers is `style-src 'self'`, so a style="" attribute or a
 * <style> block is simply dropped by the browser. If something looks unstyled
 * after an edit, that is the first thing to check.
 *
 * The colours are the app's (constants/theme.ts), so the site reads as the
 * same place a reader lands in after installing: black, warm surfaces, gold.
 *
 * The fonts are SELF-HOSTED (assets/fonts, SIL OFL — the licences sit next to
 * them). Loading Cinzel and DM Sans from Google's servers would hand every
 * visitor's IP address to Google before they had agreed to anything; German
 * courts have ruled exactly that a GDPR breach (LG München I, 20.01.2022), and
 * the owner lives there. This site makes no third-party request at all, except
 * the profile lookup on a profile page.
 */

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/Cinzel_400Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/Cinzel_700Bold.ttf') format('truetype');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/DMSans_400Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/DMSans_500Medium.ttf') format('truetype');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/DMSans_700Bold.ttf') format('truetype');
}

:root {
  /* constants/theme.ts */
  --bg: #000000;
  --surface: #1A1816;
  --gold: #C9A96E;
  --gold-light: #D4B87A;
  --text: #E0DBD2;
  /* The app's secondary grey. 4.6:1 on black — it passes AA by a hair and
     only on pure black (3.9:1 on a surface), so it is kept for the copyright
     line and nothing else. */
  --text-secondary: #7A756C;
  /* Secondary text a person is actually meant to read: same warm grey,
     lightened to 8.4:1 on black / 7:1 on a surface. */
  --text-muted: #A8A399;
  /* The separator rule of the app: 1px gold at half strength. */
  --rule: rgba(201, 169, 110, 0.5);
  --rule-faint: rgba(201, 169, 110, 0.18);
  --danger: #E0766F;

  --font-heading: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --measure: 720px;
  --gutter: 24px;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* A long email address or URL must wrap rather than push a 320px phone
     into sideways scrolling. */
  overflow-wrap: break-word;
}

/* The `hidden` attribute is how the scripts switch states. Any `display` set
   on a class below would otherwise win over it. */
[hidden] {
  display: none !important;
}

/* ─── Links, focus ─────────────────────────────────────────────────────── */

a {
  color: var(--gold);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--gold-light);
}

:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--gold);
  color: #000000;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
}
.skip-link:focus {
  top: 12px;
  color: #000000;
}

/* ─── Shell: header, main, footer ──────────────────────────────────────── */

.site-header {
  padding: 28px var(--gutter) 24px;
  text-align: center;
}

.wordmark {
  display: inline-block;
  padding: 6px 4px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  /* Letter-spacing adds a trailing gap after the last letter; the matching
     indent puts the word back on the optical centre. */
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: var(--gold);
  text-decoration: none;
}
.wordmark:hover {
  color: var(--gold-light);
}

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 8px var(--gutter) 72px;
}

.site-footer {
  margin: 0 var(--gutter);
  padding: 28px 0 40px;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-size: 15px;
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 28px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.site-footer a {
  display: inline-block;
  padding: 6px 2px;
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}
.site-footer p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ─── Type ─────────────────────────────────────────────────────────────── */

h1,
h2,
h3 {
  font-family: var(--font-heading);
  color: var(--gold);
  line-height: 1.25;
  margin: 0;
}

h1 {
  font-weight: 700;
  font-size: clamp(26px, 6.2vw, 36px);
  letter-spacing: 0.06em;
  margin: 24px 0 20px;
}

h2 {
  font-weight: 700;
  font-size: clamp(19px, 4.6vw, 23px);
  letter-spacing: 0.03em;
  margin: 48px 0 14px;
}

h3 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  margin: 32px 0 10px;
}

p {
  margin: 0 0 18px;
}

strong {
  font-weight: 700;
  color: #F3ECDF; /* the app's ivory: bold reads as emphasis, not as a link */
}

ul,
ol {
  margin: 0 0 18px;
  padding-left: 1.35em;
}
li {
  margin-bottom: 8px;
}
li > ul,
li > ol {
  margin-top: 8px;
  margin-bottom: 0;
}
ul > li::marker {
  color: var(--gold);
}
ol > li::marker {
  color: var(--gold);
  font-weight: 700;
}

hr {
  height: 1px;
  margin: 44px 0;
  border: 0;
  background: var(--rule);
}
/* Every section in the legal documents opens with a rule followed by its
   heading; the rule already carries the spacing. */
hr + h2 {
  margin-top: 0;
}

blockquote {
  margin: 0 0 18px;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--rule);
  color: var(--text-muted);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
}

address {
  font-style: normal;
  margin: 0 0 18px;
}

.lede {
  font-size: 19px;
  color: var(--text);
}
.muted {
  color: var(--text-muted);
}
.fineprint {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ─── Tables (the legal documents are full of them) ────────────────────── */

/* The wrapper scrolls sideways on a phone, so a three-column table keeps
   readable column widths instead of being crushed to four letters a line.
   tabindex="0" on it makes that scroll reachable from a keyboard. */
.table-scroll {
  margin: 0 0 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rule-faint);
  border-radius: 10px;
  background: var(--surface);
}
table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}
th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule-faint);
}
tr:last-child > td {
  border-bottom: 0;
}
th {
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  border-bottom-color: var(--rule);
}
td:first-child {
  min-width: 150px;
}

/* ─── Buttons ──────────────────────────────────────────────────────────── */

/* The app's primary button (app/login.tsx): no fill, a gold outline, gold
   bold label. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 340px;
  min-height: 52px;
  padding: 14px 24px;
  border: 1.5px solid var(--gold);
  border-radius: 12px;
  background: transparent;
  color: var(--gold);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  background: rgba(201, 169, 110, 0.1);
  color: var(--gold-light);
}
.btn:active {
  background: rgba(201, 169, 110, 0.18);
}
.btn-solid {
  background: var(--gold);
  color: #000000;
}
.btn-solid:hover {
  background: var(--gold-light);
  color: #000000;
}
.btn-solid:active {
  background: var(--gold);
}
.btn-quiet {
  border-color: var(--rule);
  font-weight: 500;
}

/* ─── Home ─────────────────────────────────────────────────────────────── */

.hero {
  padding: 24px 0 8px;
  text-align: center;
}
.hero-icon {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 28px;
  border-radius: 22px;
}
.hero h1 {
  font-size: clamp(32px, 9vw, 52px);
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  margin: 0 0 10px;
}
.tagline {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(16px, 4.4vw, 20px);
  letter-spacing: 0.04em;
  color: var(--text);
}

.coming-soon {
  margin: 40px 0 0;
  padding: 28px 20px;
  border: 1px solid var(--rule-faint);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
}
.coming-soon h2 {
  margin: 0 0 8px;
  font-size: 18px;
  letter-spacing: 0.08em;
}
.coming-soon p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* ─── Contact cards (support) ──────────────────────────────────────────── */

.card {
  margin: 0 0 16px;
  padding: 22px 22px 6px;
  border: 1px solid var(--rule-faint);
  border-radius: 14px;
  background: var(--surface);
}
.card h2 {
  margin: 0 0 10px;
  font-size: 17px;
  letter-spacing: 0.06em;
}
.card .contact {
  font-size: 18px;
  font-weight: 500;
}

/* ─── Steps (delete-account) ───────────────────────────────────────────── */

.steps {
  padding-left: 1.5em;
}
.steps li {
  margin-bottom: 12px;
  padding-left: 4px;
}

/* ─── Centered single-purpose pages: /code and profiles ────────────────── */

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 24px;
  text-align: center;
}
.stage h1 {
  font-size: clamp(20px, 5.4vw, 26px);
  letter-spacing: 0.1em;
  margin: 8px 0 12px;
}
/* Each state of a page is its own block inside the stage. Without an explicit
   width a centred flex child grows to its longest unbroken word — a bio with
   one long hashtag pushed the whole profile off a 320px screen. */
.stage > section,
.stage > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
}
.stage p,
.stage h1 {
  max-width: min(440px, 100%);
  /* Names and bios are other people's text: a 30-letter handle-style name or
     a pasted URL has to break somewhere. */
  overflow-wrap: anywhere;
}
.stage .btn {
  margin-top: 12px;
}

.code-digits {
  display: block;
  margin: 20px 0 20px;
  padding: 22px 12px 22px;
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--surface);
  color: #F3ECDF;
  font-family: var(--font-body);
  font-weight: 700;
  /* Eight digits and a gap have to fit a 320px phone on one line. */
  font-size: clamp(30px, 10.5vw, 48px);
  line-height: 1.1;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  -webkit-user-select: all;
  user-select: all;
}
.code-gap {
  display: inline-block;
  width: 0.4em;
}

/* The textarea the copy fallback selects from (assets/code.js). On screen —
   a display:none field cannot be selected — but out of sight and out of the
   layout. 16px stops iOS zooming the page when it takes focus. */
.clipboard-helper {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;
  pointer-events: none;
}

.status {
  min-height: 1.65em;
  margin: 12px 0 0;
  font-weight: 500;
  color: var(--gold-light);
}

.avatar {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 8px 0 18px;
  border-radius: 50%;
  border: 1.5px solid var(--rule);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-initials {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 38px;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.profile-name {
  margin: 0 0 2px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(22px, 6vw, 28px);
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1.25;
  max-width: 100%;
}
.profile-handle {
  margin: 0 0 16px;
  color: var(--gold);
  font-weight: 500;
}
.profile-bio {
  margin: 0 0 20px;
  /* A bio is the reader's own text: keep the line breaks they typed. */
  white-space: pre-line;
}
.profile-counts {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}
.profile-counts li {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.profile-counts .count {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text);
}

.private-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 12px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.private-line svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.spinner {
  width: 32px;
  height: 32px;
  margin: 72px 0;
  border-radius: 50%;
  border: 2px solid var(--rule-faint);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 4s;
  }
}

.stage-divider {
  width: 100%;
  max-width: 340px;
  margin: 36px 0 20px;
}

/* ─── Narrow phones (320px) ────────────────────────────────────────────── */

@media (max-width: 360px) {
  :root {
    --gutter: 18px;
  }
  body {
    font-size: 16px;
  }
  .profile-counts {
    gap: 24px;
  }
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }
  h1,
  h2,
  h3,
  th,
  strong,
  a {
    color: #000000;
  }
  .site-header,
  .site-footer,
  .skip-link {
    display: none;
  }
  .table-scroll {
    overflow: visible;
    background: none;
    border-color: #999999;
  }
  table {
    min-width: 0;
  }
}
