/* ==========================================================================
   Uncensored Room - en-US typography & US layout conventions
   --------------------------------------------------------------------------
   Loaded AFTER app.css / console.css so every rule below wins on equal
   specificity.

   Apple system typography (the same families used on apple.com):
     Display : SF Pro Display  - brand mark, hero, page titles
     UI/body : SF Pro Text     - everything else
     Numerals: SF Mono         - room codes, timestamps, IDs, counters

   SF Pro / SF Mono ship with Apple devices but are NOT redistributable as
   webfonts: the Apple Font License limits downloaded fonts to UI mockups.
   Apple's sanctioned way to use them on the web is the -apple-system /
   system-ui stack, which renders the genuine SF fonts on macOS, iOS and iPadOS
   with zero network requests. Windows and Linux fall back to the self-hosted
   Inter variable font (visually close to SF Pro Text) - still no third-party
   font CDN, so no visitor IPs leak and the UI keeps working offline.
   ========================================================================== */

/* ------------------------------------------------------------------ @font-face */
/* Only the cross-platform fallback is fetched. Apple devices use system fonts. */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

/* ------------------------------------------------------------------- tokens */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', Inter, system-ui,
             'Segoe UI', Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', Inter,
                  system-ui, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas,
               'Liberation Mono', monospace;
  --measure: 72ch;          /* comfortable English line length on wide screens */
  --ink: #16241c;
  --ink-2: #4a5a50;
}

/* ------------------------------------------------------- US typographic base */
body {
  font-family: var(--font-ui);
  font-size: 15.5px;
  line-height: 1.6;         /* English needs more leading than CJK */
  letter-spacing: 0;        /* CJK layouts add .2-.5px tracking; English reads tighter */
  color: var(--ink);
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.chat-body { font-size: 14px; }   /* keep the chat shell compact */

button, input, textarea, select { font-family: inherit; letter-spacing: 0; }

p, li, dd, dt, blockquote { line-height: 1.65; }

/* US convention: body copy is left-aligned and capped at a readable measure.
   Centered hero blocks stay centered; the text inside them does not. */
.auth-brand p, .mine-desc, .notfound p, .modal-tip, .field-hint,
.auth-hint, .mine-alert, .peek-text, .card-sub, .sheet-status {
  text-align: left;
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
  letter-spacing: 0;
}
.auth-hint { text-align: center; }     /* short one-liners may center */
/* The offline card centers its shell; prose inside it still reads left. */
.auth-card > p {
  text-align: left;
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}
.toast, .sys-msg, .time-divider { letter-spacing: 0; }

/* Sentence case is the US UI default - no tracked-out all-caps micro labels. */
.stat-label, .privacy-badge, .panel-title, .rc-badge, .pill,
.group-title, .auth-btn, .share-room { letter-spacing: 0; }
.stat-label { text-transform: none; }

/* ------------------------------------------------------------- display type */
/* SF Pro Display: tight tracking and real weights, no faux italics. */
.auth-brand h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(34px, 4.6vw, 62px);
  line-height: 1.12;
  letter-spacing: -0.035em;   /* large SF Pro Display needs negative tracking */
  color: #123324;
  margin: 0 0 18px;
  overflow-wrap: anywhere;    /* join-gate pages show long room names */
}
.auth-brand h1 em {
  font-style: normal;
  font-weight: 300;
  color: #0a7a45;
  letter-spacing: -0.035em;
}
.auth-brand p.brand-tagline {
  font-family: var(--font-ui);
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 46ch;
  margin: 0 0 20px;
  text-align: left;
}
.console-logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.03em;
}
.mine-title, .notfound h1, .sheet-name {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #123324;
}
.mine-title { font-size: clamp(30px, 4vw, 38px); }
.notfound h1 { font-size: 30px; }
.sheet-name { font-size: 24px; }
/* Admin stays in the UI stack: a console should read as a tool, not a magazine. */
.console-title { font-family: var(--font-ui); font-weight: 600; letter-spacing: -0.01em; }

/* --------------------------------------------------------- numerical / mono */
.share-code, .code-input, .rm-code, .rc-code, .room-link,
td.mono, .mono, .hash-cell, .search-time, .msg-time,
.file-size, .voice-dur, .stat-value, .poll-count, .rm-unread,
.group-count, .time-divider span, .search-room, .card-sub,
.rc-meta time, .rc-last time, time {
  font-variant-numeric: tabular-nums;
}
.share-code, .code-input, .rm-code, .rc-code, .room-link,
td.mono, .mono, .hash-cell, .voice-dur, .time-divider span {
  font-family: var(--font-mono);
}
.share-code { font-size: 32px; font-weight: 500; letter-spacing: .16em; }
.code-input { font-size: 15px; letter-spacing: .1em; }
.time-divider span { font-size: 11.5px; letter-spacing: .01em; }

/* --------------------------------------------------------- sign in / sign up */
.auth-wrap { gap: clamp(48px, 7vw, 110px); }
.auth-brand { max-width: 520px; }
.privacy-badge {
  font-size: 13px;
  letter-spacing: 0;
  font-weight: 500;
  padding: 6px 13px;
  margin-bottom: 20px;
}
.zero-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 18px;
  max-width: 100%;
}
.zero-bar b {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 4px 11px;
}
.zero-bar span {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.45;
}
.auth-card {
  width: min(100%, 440px);   /* English labels run ~40% longer than Chinese */
  padding: 34px 36px 30px;
}
.auth-tabs { gap: 28px; }
.auth-tabs .tab { font-size: 15px; font-weight: 500; letter-spacing: 0; }
.auth-tabs .tab.active { font-weight: 600; }
.auth-error, .mine-alert {
  font-size: 13.5px;
  line-height: 1.55;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.field > span {
  font-size: 13px;
  font-weight: 600;          /* US forms use a clear, darker label above the field */
  color: #3d4b43;
  letter-spacing: 0;
  margin-bottom: 7px;
}
.field input {
  height: 46px;
  font-size: 16px;           /* 16px stops iOS Safari from zooming on focus */
  letter-spacing: 0;
}
.field input::placeholder, .inline-form input::placeholder {
  color: #93a099;
  opacity: 1;
}
.auth-btn {
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;         /* tracked-out CTA text is a CJK-layout habit */
}
.auth-hint { font-size: 13px; line-height: 1.65; }
.auth-hint a { font-weight: 500; }

/* ------------------------------------------------------------------- the app */
.bubble, .msg-text, .quote-text, .search-text, .announce-text,
.chain-item, .reply-text, .file-name, .modal-tip, .field-hint {
  overflow-wrap: anywhere;
  hyphens: auto;
}
.bubble {
  font-size: 15px;
  line-height: 1.58;
  letter-spacing: 0;
  word-break: normal;        /* break-word splits English mid-word; use hyphenation */
}
.composer textarea { font-size: 15px; line-height: 1.55; letter-spacing: 0; }
.room-name, .me-name, .rm-name, .rc-name, .req-name {
  letter-spacing: -0.01em;
}
.msg-name, .room-sub, .member-sub, .sys-msg span, .file-size,
.video-name, .search-time, .rm-code, .rc-meta { letter-spacing: 0; }
.c-btn, .mini-btn, .pill, .tab, .msg-action, .icon-btn {
  letter-spacing: 0;
  white-space: nowrap;
}
.notfound { padding: 44px 40px; }
.notfound p {
  font-size: 14px;
  line-height: 1.65;
  text-align: left;
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}

/* ---------------------------------------------------------- my rooms / admin */
.mine-desc { font-size: 14px; line-height: 1.65; }
.mine-empty p { font-size: 14px; line-height: 1.6; }
.console-sub, .rc-last, .rc-meta, .stat-hint { letter-spacing: 0; }
table.data-table { font-size: 13px; }
table.data-table th { font-weight: 600; letter-spacing: 0; }
.msg-preview, .search-text, .share-url, .chain-item { word-break: normal; overflow-wrap: anywhere; }

/* ------------------------------------- English text expansion / narrow widths */
/* English strings are 30-80% longer than Chinese. Never let a label push a
   flex row past the viewport, and never clip a button's text silently. */
.auth-card, .console-card, .app, .modal, .sheet, .notfound { min-width: 0; }
button, .c-btn, .auth-btn, .mini-btn, .pill, .tab, .tag {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inline-form { flex-wrap: wrap; }
.inline-form input, .inline-form select, .inline-form button { min-width: 0; }
.console-head { flex-wrap: wrap; }
.me-name, .room-name, .rm-name, .rc-name, .file-name,
.msg-preview, .reply-text, .hash-cell, .share-url { min-width: 0; }

@media (max-width: 900px) {
  .auth-brand h1 { font-size: clamp(30px, 6vw, 46px); }
  .auth-brand p.brand-tagline { max-width: 52ch; }
}

@media (max-width: 480px) {
  body { font-size: 14.5px; }
  body.chat-body { font-size: 14px; }
  .auth-body { padding: 28px 16px; }
  .auth-wrap { gap: 28px; }
  .auth-brand { max-width: 100%; }
  .auth-brand h1 { font-size: 32px; }
  .auth-brand p.brand-tagline { font-size: 14px; max-width: 100%; }
  .zero-bar { padding: 12px 14px; }
  .auth-card { width: 100%; padding: 24px 20px 22px; }
  .auth-tabs { gap: 22px; }
  .bubble { font-size: 15px; }
  .notfound { padding: 32px 22px; }
  .mine-title { font-size: 30px; }
  table.data-table { font-size: 12.5px; }
}

@media (max-width: 360px) {
  .auth-brand h1 { font-size: 28px; }
  .auth-tabs .tab { font-size: 14px; }
  .zero-bar span { font-size: 12.5px; }
}

/* Respect user preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
