/* howareu.today — ชั้นแบรนด์
 * แนวคิด: โต๊ะเล็กๆ ริมหน้าต่าง พื้นเขียวยูคาลิปตัสอ่อน เขียวเข้มเป็นสีเน้นสีเดียว
 * ชมพูอมเทาสงวนไว้ใช้กับไพ่กลับหัวเท่านั้น
 */
:root {
  --ground: #eef1ec;
  --paper: #ffffff;
  --ink: #16232b;
  --muted: #5c6b72;
  --line: #d6dcd4;
  --accent: #22635a;
  --accent-soft: #dfeae4;
  --rev: #a45a6b;
  --shadow: 0 1px 2px rgba(22, 35, 43, 0.06), 0 8px 24px rgba(22, 35, 43, 0.05);
  --serif: "Trirong", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans Thai", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0f181c;
    --paper: #16232a;
    --ink: #e7ede9;
    --muted: #9aada9;
    --line: #26383e;
    --accent: #74c3b1;
    --accent-soft: #1a2e30;
    --rev: #d28ea0;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

main { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; text-wrap: balance; }
p { margin: 0 0 12px; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- chrome ---------- */
.top {
  max-width: 1040px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 22px 20px 18px;
}
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; }
.brand-name { font-family: var(--serif); font-size: 1.35rem; }
.brand-tld { font-size: 0.72rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--accent); }
.top nav { display: flex; gap: 20px; font-size: 0.86rem; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--accent); }

.foot {
  max-width: 1040px; margin: 80px auto 0;
  padding: 18px 20px 48px; border-top: 1px solid var(--line);
  font-size: 0.82rem; line-height: 1.8; color: var(--muted);
}
.foot p { margin: 0 0 6px; }

/* ---------- type blocks ---------- */
.hero { padding: 24px 0 40px; }
.hero h1 { margin: 0; font-size: clamp(2.4rem, 8vw, 3.1rem); line-height: 1.25; max-width: 16ch; }
.lede { margin-top: 16px; max-width: 46ch; font-family: var(--serif); font-size: 1.1rem; line-height: 1.95; color: var(--muted); }
.lede-sm { max-width: 52ch; font-size: 0.95rem; line-height: 1.9; color: var(--muted); }
.eyebrow { margin: 0 0 8px; font-size: 0.7rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent); }
.page-head { padding: 24px 0 28px; }
.page-head h1 { margin: 0; font-size: clamp(1.8rem, 6vw, 2.1rem); line-height: 1.3; max-width: 22ch; }
.note { font-size: 0.86rem; line-height: 1.8; color: var(--muted); }

/* ---------- the instrument ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 24px 20px; }
.panel fieldset { margin: 0 0 24px; padding: 0; border: 0; }
.panel legend { padding: 0; margin-bottom: 12px; font-size: 0.82rem; color: var(--muted); }
.field-label { display: block; margin-bottom: 8px; font-size: 0.82rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip span {
  display: inline-block; cursor: pointer; padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 0.9rem; transition: 0.15s;
}
.chip input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip span:hover { border-color: var(--accent); }

textarea {
  width: 100%; margin-bottom: 24px; padding: 13px 15px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px; background: var(--ground);
  color: var(--ink); font-family: var(--serif); font-size: 1rem;
}
textarea:focus { border-color: var(--accent); outline: none; }

.spreads { display: grid; gap: 8px; }
@media (min-width: 640px) { .spreads { grid-template-columns: repeat(3, 1fr); } }
.spread input { position: absolute; opacity: 0; width: 0; height: 0; }
.spread-body {
  display: block; cursor: pointer; height: 100%; padding: 13px 16px;
  border: 1px solid var(--line); border-radius: 10px; transition: 0.15s;
}
.spread input:checked + .spread-body { border-color: var(--accent); background: var(--accent-soft); }
.spread input:focus-visible + .spread-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.spread-body:hover { border-color: var(--accent); }
.spread-name { display: block; font-family: var(--serif); font-size: 1.02rem; }
.spread-blurb { display: block; margin-top: 4px; font-size: 0.8rem; line-height: 1.6; color: var(--muted); }

.cta-draw {
  display: block; width: 100%; padding: 15px 24px; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; font-family: var(--sans); font-size: 1.05rem;
  cursor: pointer; transition: 0.15s;
}
.cta-draw:hover { filter: brightness(1.07); }
.cta-draw:active { transform: translateY(1px); }
.cta-draw.inline { display: inline-block; width: auto; padding: 13px 22px; font-size: 0.97rem; text-decoration: none; }

.btn-outline {
  display: inline-block; padding: 12px 20px; border: 1px solid var(--accent); border-radius: 10px;
  background: transparent; color: var(--accent); font-family: var(--sans); font-size: 0.95rem;
  cursor: pointer; text-decoration: none;
}

/* ---------- the table ---------- */
.table { display: grid; justify-items: center; gap: 20px 12px; margin-top: 8px; }
.table.spread-1 { grid-template-columns: minmax(0, 190px); }
.table.spread-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 620px; margin-inline: auto; }
.table.spread-10 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; margin-inline: auto; }
@media (min-width: 760px) { .table.spread-10 { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 100%; } }

.slot { width: 100%; max-width: 178px; }
.pos { margin: 0 0 8px; min-height: 2.4em; text-align: center; font-size: 0.72rem; line-height: 1.2rem; color: var(--muted); }
.card { display: block; width: 100%; aspect-ratio: 5 / 8.6; padding: 0; border: 0; background: none; cursor: pointer; perspective: 1100px; }
.card-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.72s cubic-bezier(0.2, 0.8, 0.25, 1); }
.card.is-open .card-inner { transform: rotateY(180deg); }
.card-back, .card-face { position: absolute; inset: 0; display: block; overflow: hidden; border-radius: 6px; backface-visibility: hidden; box-shadow: var(--shadow); }
.card-back {
  border: 1px solid #1b4a45; background-color: #1d4f49;
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 6px, transparent 6px 12px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.07) 0 6px, transparent 6px 12px),
    radial-gradient(circle at 50% 42%, rgba(238, 241, 236, 0.22), transparent 58%);
}
.card:hover .card-back { border-color: var(--accent); }
.card-face { transform: rotateY(180deg); border: 1px solid var(--line); background: #fff; }
.card-face .plate { width: 100%; height: 100%; object-fit: cover; border: 0; border-radius: 0; }
.card-name { margin: 8px 0 0; text-align: center; font-size: 0.8rem; line-height: 1.5; }
.tap-hint { margin-top: 26px; text-align: center; font-size: 0.88rem; color: var(--muted); }

.plate { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.plate.is-rev { transform: rotate(180deg); border-color: var(--rev); }

/* ---------- reading ---------- */
.reading-head { padding: 24px 0 22px; }
.question { margin: 0; font-size: clamp(1.5rem, 5vw, 1.9rem); line-height: 1.4; max-width: 24ch; }
.reading { margin-top: 44px; display: flex; flex-direction: column; gap: 12px; }
.rc { padding: 16px 20px; border-radius: 10px; border-left: 3px solid var(--accent); background: var(--paper); box-shadow: var(--shadow); }
.rc.is-rev { border-left-color: var(--rev); }
.rc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.rc-head h3 { margin: 0; font-size: 1.18rem; }
.rc-pos { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.rc-text { margin: 8px 0 0; font-family: var(--serif); font-size: 1rem; line-height: 2; }
.tag { padding: 1px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.68rem; color: var(--muted); }
.tag-rev { border-color: var(--rev); color: var(--rev); }
.tag-en { font-size: 0.72rem; color: var(--muted); }
.kw { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kw span { padding: 2px 9px; border-radius: 5px; background: var(--accent-soft); font-size: 0.78rem; }
.kw-rev span { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.summary { margin-top: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--accent-soft); }
.summary ul { margin: 0; padding-left: 20px; font-family: var(--serif); font-size: 1rem; line-height: 2; }
.summary li { margin-bottom: 6px; }
.reading-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }

/* ---------- อ่านเชิงลึกด้วย AI (เฟส 2) ---------- */
.deep { margin-top: 20px; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: var(--shadow); }
.deep-intro { margin: 0 0 8px; font-family: var(--serif); font-size: 1.08rem; }
.deep-consent { margin: 0 0 16px; }
.deep-consent strong { color: var(--ink); }
.deep-result { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); font-family: var(--serif); font-size: 1.05rem; line-height: 1.95; }
.deep-result p { margin: 0 0 14px; }
.deep-result p:last-child { margin-bottom: 0; }

/* ---------- library ---------- */
.how, .library, .suit { margin-top: 80px; }
.how h2, .library h2 { margin: 0 0 8px; font-size: 1.5rem; }
.how-grid { display: grid; gap: 28px; margin-top: 24px; }
@media (min-width: 720px) { .how-grid { grid-template-columns: repeat(3, 1fr); gap: 32px; } }
.how-item { border-top: 1px solid var(--line); padding-top: 16px; }
.how-item h3 { margin: 0; font-size: 1.08rem; }
.how-item p { margin: 8px 0 0; font-size: 0.92rem; line-height: 1.8; color: var(--muted); }

.grid-6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 12px; margin-top: 20px; }
@media (min-width: 720px) { .grid-6 { grid-template-columns: repeat(6, 1fr); } }
.tile { text-decoration: none; }
.tile span { display: block; margin-top: 8px; text-align: center; font-size: 0.76rem; line-height: 1.4; }
.suit-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.suit-head h2 { margin: 0; font-size: 1.3rem; }
.suit-head span { font-size: 0.82rem; color: var(--muted); }
.library .btn-outline { margin-top: 24px; }

/* ---------- single card ---------- */
.card-page { display: grid; gap: 32px; padding-top: 24px; }
@media (min-width: 720px) { .card-page { grid-template-columns: 240px 1fr; } }
.card-page h1 { margin: 0; font-size: clamp(1.7rem, 6vw, 2rem); line-height: 1.3; }
.card-en { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }
.side { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 16px; }
.side h2 { margin: 0; font-size: 1.15rem; }
.side p { margin: 8px 0 0; font-family: var(--serif); font-size: 1.02rem; line-height: 2; }
.side-rev h2 { color: var(--rev); }

/* ---------- prose ---------- */
.prose { display: flex; flex-direction: column; gap: 24px; max-width: 62ch; padding-bottom: 24px; }
.prose-item { border-top: 1px solid var(--line); padding-top: 16px; }
.prose-item h2 { margin: 0; font-size: 1.15rem; }
.prose-item p { margin: 8px 0 0; font-size: 0.95rem; line-height: 2; color: var(--muted); }

/* ---------- insight ---------- */
.stats { display: grid; gap: 24px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); gap: 32px; } }
.stat { border-top: 1px solid var(--line); padding-top: 16px; }
.stat-label { margin: 0; font-size: 0.78rem; color: var(--muted); }
.stat-value { margin: 4px 0 0; font-family: var(--serif); font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-hint { margin: 8px 0 0; font-size: 0.76rem; color: var(--muted); }
.chart-wrap, .two-col { margin-top: 56px; }
.chart-wrap h2, .two-col h2 { margin: 0 0 16px; font-size: 1.3rem; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 130px; overflow-x: auto; }
.bar-col { display: flex; flex: 1; min-width: 18px; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.bar-n { font-size: 0.68rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { width: 100%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent); }
.two-col { display: grid; gap: 40px; }
@media (min-width: 720px) { .two-col { grid-template-columns: 1fr 1fr; } }
.rows { margin: 0; padding: 0; list-style: none; }
.rows li { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding: 8px 0; font-size: 0.92rem; }
.rows li span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- daily ---------- */
.daily { margin-top: 80px; }
.daily h2 { margin: 0 0 16px; font-size: 1.4rem; }
.daily-body { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 640px) { .daily-body { flex-direction: row; align-items: flex-start; } }
.daily-plate { width: 140px; flex: none; }
.daily h3 { margin: 0; font-size: 1.2rem; }
.daily-text { margin: 8px 0 0; font-family: var(--serif); font-size: 1rem; line-height: 2; }

@media (prefers-reduced-motion: reduce) {
  .card-inner { transition: none; }
}
