/* Ruff Night website styles.
 *
 * Palette from docs/reference/REDESIGN_PLAN.md §6 so the site matches the app.
 * Light only, matching the app's forced light mode (LESSONS.md §4), so every
 * colour is stated outright rather than inherited from the browser.
 */

:root {
  --paper:      #FCEFD5;
  --paper-deep: #F3DFB6;
  --card:       #FFFAEB;
  --ink:        #40301F;
  --ink-soft:   #7D6749;
  --ink-faint:  #A89273;
  --rule:       rgba(96, 68, 32, 0.22);
  --accent:     #F4D072;
  --accent-deep:#DDB447;
  --sage:       #6F9350;
  --honey:      #C08A26;

  --measure: 36rem;   /* prose column */
  --wide:    50rem;   /* tables and other wide content */
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont,
               "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain, as an inline SVG so the page makes no external requests. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.45;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23n)' opacity='0.22'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.wrap-wide { max-width: var(--wide); }

/* ── Masthead ────────────────────────────────────────────────────────────── */

.masthead {
  padding: 2.75rem 0 1.25rem;
  text-align: center;
}

.mark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
}

.mark img {
  width: 72px;
  height: 72px;
  border-radius: 22%;
  display: block;
  border: 1px solid var(--rule);
}

.mark span {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.mark:hover span { color: var(--accent-deep); }

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

h1 {
  font-size: 1.95rem;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0.5rem 0 0.3rem;
}

h2 {
  font-size: 1.2rem;
  line-height: 1.3;
  font-weight: 700;
  margin: 2.5rem 0 0.65rem;
}

p { margin: 0 0 1rem; }

a { color: var(--ink); text-decoration-color: var(--accent-deep); text-underline-offset: 3px; }
a:hover { color: var(--accent-deep); }

.stamp {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 0 0 2rem;
}

.lede {
  font-size: 1.08rem;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

ul { margin: 0 0 1rem; padding-left: 1.2rem; }
li { margin-bottom: 0.4rem; }
li::marker { color: var(--ink-faint); }

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1.5px solid var(--rule);
  padding: 1.2rem 1.4rem;
  margin: 1.5rem 0;
  border-radius: 20px 14px 22px 16px;
}

.card > :first-child { margin-top: 0; }
.card > :last-child  { margin-bottom: 0; }

.card h2:first-child { margin-top: 0; }

/* ── Data table ──────────────────────────────────────────────────────────
 * Breaks out wider than the prose column. A three-column table inside a
 * 36rem measure squeezes the middle column to two or three words a line.
 */

.tablewrap {
  width: min(var(--wide), 100vw - 2.5rem);
  margin: 1.25rem 0 1.5rem;
  margin-left: 50%;
  transform: translateX(-50%);
  overflow-x: auto;
  border: 1.5px solid var(--rule);
  border-radius: 18px 13px 20px 15px;
  background: var(--card);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
  line-height: 1.5;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--rule);
}

thead th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }

td:first-child { font-weight: 600; width: 11rem; }
td:last-child  { white-space: nowrap; }

.keep { color: var(--sage); font-weight: 600; }
.hold { color: var(--honey); font-weight: 600; }

/* On a phone a three-column table cannot work, so each row becomes a block. */
@media (max-width: 34rem) {
  .tablewrap {
    width: auto;
    margin-left: 0;
    transform: none;
    overflow-x: visible;
  }
  table, tbody, tr, td { display: block; width: auto; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--rule); padding: 0.35rem 0; }
  tbody tr:last-child { border-bottom: none; }
  td { border-bottom: none; padding: 0.15rem 1rem; }
  td:first-child { width: auto; font-size: 1rem; padding-top: 0.75rem; }
  td:last-child { white-space: normal; padding-bottom: 0.75rem; font-size: 0.85rem; }
  td:last-child::before { content: "Kept: "; color: var(--ink-faint); font-weight: 400; }
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer {
  margin-top: 3.5rem;
  padding: 1.75rem 0 2.5rem;
  border-top: 1.5px solid var(--rule);
  background: var(--paper-deep);
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

footer a { color: var(--ink-soft); }

/* ── Landing page ────────────────────────────────────────────────────────── */

.hero { text-align: center; }
.hero h1 { font-size: 2.2rem; }

.points {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  margin: 2.25rem 0;
}

.points .card { margin: 0; }
.points h3 { font-size: 1rem; font-weight: 700; margin: 0 0 0.4rem; }
.points p { font-size: 0.94rem; color: var(--ink-soft); margin: 0; }

@media (max-width: 30rem) {
  body { font-size: 16px; }
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 1.95rem; }
  .wrap { padding: 0 1.15rem; }
}
