/* style.css — how the site looks. Phones first; wider screens get more room. */

:root {
  --paper: #F7F5F0;
  --card: #FFFFFF;
  --ink: #1C1B19;
  --ink-soft: #45423D;
  --ink-muted: #6B675F;
  --line: #E4E0D7;
  --accent: #1F4FA8;
  --accent-wash: #E6EDF9;
  --open-ink: #1D5C36;
  --open-wash: #E1F1E6;
  --members-ink: #7A4A06;
  --members-wash: #FBEBD2;
  --danger: #A32D2D;
  --display: 'Newsreader', Georgia, serif;
  --body: 'Figtree', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--body); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 32px; }
h2 { font-size: 22px; }
mark { background: #FFF1A8; color: inherit; padding: 0 2px; border-radius: 3px; }

/* ---------- Top bar: name on the left, account on the right ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.logo { font: 600 24px var(--display); }
.topbar { flex-wrap: wrap; }
.topnav { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 16px; font-size: 15px; font-weight: 500; }
#account { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
#account > * { white-space: nowrap; }

main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; display: flex; flex-direction: column; gap: 16px; outline: none; }

/* ---------- Home: the big search box and Trend Rank ---------- */
.home { padding-top: 7vh; gap: 28px; display: flex; flex-direction: column; }
.home-title { text-align: center; font-size: 44px; }
.home-sub { text-align: center; color: var(--ink-muted); margin: -16px 0 0; }

.search { display: flex; flex-direction: row; gap: 8px; }
.search input {
  flex: 1; min-width: 0; height: 56px; padding: 0 20px;
  border: 2px solid var(--ink); border-radius: 28px; background: var(--card);
  font: 400 18px var(--body); color: var(--ink);
}
.search button { height: 56px; padding: 0 24px; border-radius: 28px; }

.trend { padding: 20px 24px; }
.trend-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; }
.trend-list li a {
  display: flex; align-items: baseline; gap: 14px;
  min-height: 44px; padding: 8px 4px; border-bottom: 1px solid var(--line);
}
.trend-list li:last-child a { border-bottom: none; }
.trend-num { font: 600 22px var(--display); width: 28px; text-align: right; color: var(--accent); flex-shrink: 0; }
.trend-term { font-size: 17px; font-weight: 500; flex: 1; }
.trend-people { font-size: 13px; color: var(--ink-muted); white-space: nowrap; }

/* ---------- Shared pieces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.result { gap: 6px; }
.result-title { font: 600 20px var(--display); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-muted); }
.body-text { margin: 0; white-space: pre-line; color: var(--ink-soft); }
.entry-body { white-space: pre-line; font-size: 18px; line-height: 1.65; margin: 0; }
.crumb { font-size: 14px; color: var(--ink-muted); }
.crumb a { color: var(--accent); font-weight: 500; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.hint { color: var(--ink-muted); font-size: 15px; margin: 0; }
.error { color: var(--danger); font-size: 14px; margin: 0; }

.badge { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.badge.open { color: var(--open-ink); background: var(--open-wash); }
.badge.members { color: var(--members-ink); background: var(--members-wash); }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 20px; border: none; border-radius: 22px;
  background: var(--ink); color: #fff; font: 600 15px var(--body); cursor: pointer;
}
.button:hover { color: #fff; opacity: 0.88; }
.button.accent { background: var(--accent); }
.button.secondary { background: transparent; color: var(--ink); border: 1px solid #BDB8AD; }
.button.secondary:hover { color: var(--ink); background: var(--card); }
.button:disabled { opacity: 0.5; cursor: default; }
.link-button { background: none; border: none; padding: 8px 0; font: 600 15px var(--body); color: var(--accent); cursor: pointer; }

.empty { text-align: center; padding: 32px 20px; align-items: center; }

/* ---------- Forms ---------- */
form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
input, textarea, select {
  font: 400 16px var(--body); color: var(--ink); background: var(--card);
  padding: 11px 14px; border: 1px solid #BDB8AD; border-radius: 12px;
}
textarea { min-height: 180px; resize: vertical; line-height: 1.55; }
fieldset { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.choice { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.choice input { margin-top: 4px; }
.choice strong { display: block; }
input:focus, textarea:focus, select:focus, .button:focus-visible, a:focus-visible, .link-button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* History: each version can be opened to read it. */
details { border-top: 1px solid var(--line); padding: 12px 0; }
details:first-of-type { border-top: none; }
summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
details .entry-body { font-size: 16px; margin-top: 10px; }

/* ---------- "Not open yet" notice, footer, Terms page ---------- */
.notice {
  background: var(--members-wash); color: var(--members-ink);
  border: 1px solid #E9C98F; border-radius: 16px; padding: 16px 20px;
}
.notice strong { display: block; font-size: 17px; margin-bottom: 4px; }
.notice p { margin: 0; font-size: 15px; line-height: 1.5; }
.notice a, .agree a, .footer a { color: var(--accent); font-weight: 600; text-decoration: underline; }
.agree { font-size: 14px; line-height: 1.5; }
.footer {
  max-width: 760px; margin: 0 auto; padding: 20px 16px 40px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-muted); text-align: center;
}
.terms { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.terms h1 { font-size: 36px; margin-bottom: 8px; }
.terms h2 { margin: 28px 0 8px; }
.terms p, .terms li { color: var(--ink-soft); }
.terms hr { border: none; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---------- Close switch: the "Temporarily closed" page ---------- */
.closed { padding: 56px 20px; }

.skeleton { height: 90px; border-radius: 16px; background: #ECE8DF; }

@media (min-width: 720px) {
  .topbar { padding: 14px 32px; }
  .home-title { font-size: 56px; }
  .trend-list { grid-template-columns: 1fr 1fr; column-gap: 32px; grid-auto-flow: column; grid-template-rows: repeat(5, auto); }
  .trend-list li:nth-child(5) a { border-bottom: none; }
}
