/* ============================================================
   Philosophy.cafe — Design System
   Warm cafe quiet intellect modern gothic + handwritten warmth
   Layout A / Accent: Brown (#8a6f47) / Paper: Default (#f4efe6)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New:wght@400;500;700;900&family=Noto+Sans+JP:wght@400;500;700&family=Klee+One:wght@400;600&family=Newsreader:ital,opsz,wght@0,6..72,400;1,6..72,400;1,6..72,500&display=swap');

:root {
  /* --- palette: warm cream / espresso / latte --- */
  --paper:      #f4efe6;   /* base background */
  --paper-2:    #efe8db;   /* slightly deeper section */
  --card:       #fbf8f1;   /* raised surface */
  --ink:        #2a2824;   /* primary text / espresso */
  --ink-soft:   #4a463f;
  --muted:      #837b6d;   /* secondary text */
  --line:       #ddd3c2;   /* hairlines */
  --line-soft:  #e7ddcd;
  --latte:      #8a6f47;   /* primary accent — coffee */
  --latte-deep: #6f5836;
  --crema:      #c79a5b;   /* warm highlight */
  --accent-tint:#efe3cf;   /* tinted chip bg */

  /* fixed values (Layout A / Brown accent) */
  --t-accent:   var(--latte);
  --t-paper:    var(--paper);

  --maxw: 1180px;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;

  --font-display: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  --font-body:    "Noto Sans JP", "Zen Kaku Gothic New", sans-serif;
  --font-hand:    "Klee One", "Zen Kaku Gothic New", cursive;
  --font-latin:   "Newsreader", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--t-paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--crema); color: var(--ink); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* paper grain — extremely subtle warm texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(138,111,71,.035) 0, transparent 38%),
    radial-gradient(circle at 88% 78%, rgba(138,111,71,.04) 0, transparent 42%);
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; position: relative; z-index: 1; }
section { position: relative; z-index: 1; }

/* ---------- typographic primitives ---------- */
.eyebrow {
  font-family: var(--font-hand);
  font-size: 15px;
  font-weight: 600;
  color: var(--latte-deep);
  letter-spacing: .14em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  margin: 0 0 22px;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1.5px;
  background: var(--t-accent);
  display: inline-block;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.25; letter-spacing: .005em; margin: 0; }
.display { font-weight: 900; letter-spacing: -.01em; line-height: 1.16; }

.lead { font-size: 18px; color: var(--ink-soft); line-height: 1.95; max-width: 56ch; }
.dim { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  padding: 15px 28px;
  border-radius: 999px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .22s ease;
  white-space: nowrap;
  letter-spacing: .02em;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--latte-deep); transform: translateY(-2px); box-shadow: 0 14px 30px -12px rgba(42,40,36,.5); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); background: rgba(42,40,36,.03); }
.btn-accent { background: var(--t-accent); color: #fff; }
.btn-accent:hover { filter: brightness(.94); transform: translateY(-2px); box-shadow: 0 14px 30px -12px rgba(138,111,71,.55); }

/* ---------- chips / tags ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--latte-deep);
  background: var(--accent-tint);
  border: 1px solid var(--line-soft);
  padding: 5px 13px;
  border-radius: 999px;
  letter-spacing: .02em;
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--t-paper) 82%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 74px; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--font-display); font-weight: 900; font-size: 21px; letter-spacing: -.01em; }
.brand-logo { height: 46px; width: auto; display: block; }
.brand-text { font-family: var(--font-display); font-weight: 900; font-size: 21px; letter-spacing: -.01em; color: var(--ink); }
.brand .cup { font-family: var(--font-latin); font-style: italic; font-weight: 500; color: var(--latte); margin-left: -2px; }
.brand .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--t-accent); display: inline-block; transform: translateY(-2px); }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a { font-size: 15px; font-weight: 500; color: var(--ink-soft); transition: color .18s; }
.nav-links a:hover { color: var(--latte-deep); }

/* ---------- section rhythm ---------- */
.section-pad { padding: 108px 0; }
.section-pad-sm { padding: 72px 0; }
.tint { background: var(--paper-2); }
.dark-sec { background: var(--ink); color: #ece5d8; }
.dark-sec .eyebrow { color: var(--crema); }
.dark-sec .dim { color: #a89e8d; }

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- generic card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 18px 40px -32px rgba(42,40,36,.35);
}

/* ---------- footnote / hand accents ---------- */
.hand { font-family: var(--font-hand); }
.latin { font-family: var(--font-latin); }

/* ---------- reveal-on-scroll ---------- */
.reveal { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view) {
    .reveal {
      animation: revealIn linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 26%;
    }
  }
}
@keyframes revealIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

/* ============================================================
   Hero (Layout A - centered quiet)
   ============================================================ */
.hero { position: relative; overflow: hidden; }
.hero-steam { display: flex; gap: 5px; height: 30px; align-items: flex-end; margin-bottom: 20px; }
.hero-steam i {
  width: 3px;
  border-radius: 3px;
  background: var(--t-accent);
  opacity: .5;
  animation: steam 3.4s ease-in-out infinite;
}
.hero-steam i:nth-child(1) { height: 14px; animation-delay: 0s; }
.hero-steam i:nth-child(2) { height: 24px; animation-delay: .5s; }
.hero-steam i:nth-child(3) { height: 18px; animation-delay: 1s; }
@keyframes steam {
  0%, 100% { transform: translateY(0) scaleY(1); opacity: .35; }
  50% { transform: translateY(-6px) scaleY(1.15); opacity: .7; }
}
@media (prefers-reduced-motion: reduce) { .hero-steam i { animation: none; } }

.cta-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 38px; }
.cta-note { font-family: var(--font-hand); font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.cta-note b { color: var(--latte-deep); font-weight: 600; }

.hero-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 46px; }

/* ---- Hero A : centered quiet ---- */
.heroA { padding: 96px 0 104px; text-align: center; }
.heroA .inner { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.heroA h1 { font-size: clamp(44px, 7vw, 92px); margin: 6px 0 0; }
.heroA h1 .em { font-family: var(--font-hand); color: var(--t-accent); font-weight: 600; }
.heroA .lead { margin: 26px auto 0; text-align: center; font-size: 19px; }
.heroA .hero-tags { justify-content: center; }
.quote-mark { font-family: var(--font-latin); font-style: italic; font-size: 96px; line-height: 0; color: var(--line); height: 30px; display: block; margin-top: 14px; }

/* ============================================================
   Sections
   ============================================================ */

/* ---------- "what is" - three principles ---------- */
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 60px; }
.principle { padding: 6px 0; }
.principle .num { font-family: var(--font-latin); font-style: italic; font-size: 34px; color: var(--t-accent); line-height: 1; }
.principle h3 { font-size: 23px; margin: 18px 0 12px; }
.principle p { color: var(--ink-soft); font-size: 15.5px; line-height: 1.85; margin: 0; }
.principle .rule { width: 34px; height: 2px; background: var(--line); margin: 20px 0 0; }
@media (max-width: 760px) { .principles { grid-template-columns: 1fr; gap: 36px; } }

.manifest { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 64px; align-items: start; }
.manifest .big-q { font-family: var(--font-display); font-weight: 900; font-size: clamp(30px, 3.4vw, 42px); line-height: 1.45; letter-spacing: .005em; }
.manifest .big-q .hl { background: linear-gradient(transparent 62%, var(--crema) 62%); padding: 0 2px; }
@media (max-width: 820px) { .manifest { grid-template-columns: 1fr; gap: 34px; } }

/* ---------- federation diagram ---------- */
.fed { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.fed-steps { display: flex; flex-direction: column; gap: 0; }
.fed-step { display: flex; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line-soft); }
.fed-step:last-child { border-bottom: 0; }
.fed-step .k { font-family: var(--font-latin); font-style: italic; font-size: 22px; color: var(--t-accent); min-width: 40px; }
.fed-step h4 { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin: 0 0 6px; }
.fed-step p { margin: 0; font-size: 14.5px; color: var(--ink-soft); line-height: 1.8; }

.fed-map { position: relative; aspect-ratio: 1/1; max-width: 440px; margin: 0 auto; }
.node { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.node .dot {
  width: var(--s, 56px);
  height: var(--s, 56px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
}
.node .lbl { font-size: 12px; color: var(--muted); white-space: nowrap; }
.node-self .dot {
  background: var(--ink);
  color: var(--paper);
  --s: 104px;
  font-size: 15px;
  box-shadow: 0 16px 40px -16px rgba(42,40,36,.6);
  padding: 0;
  overflow: hidden;
}
.node-logo { width: 74px; height: 74px; object-fit: contain; }
.node-self .lbl { color: var(--latte-deep); font-weight: 600; font-family: var(--font-hand); font-size: 14px; }
.node-peer .dot { background: var(--card); color: var(--latte-deep); border: 1.5px solid var(--line); }
.fed-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fed-svg line { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 4 5; }
.fed-svg .pulse { stroke: var(--t-accent); stroke-width: 2; stroke-dasharray: 6 8; opacity: .8; animation: dash 1.6s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -28; } }
@media (prefers-reduced-motion: reduce) { .fed-svg .pulse { animation: none; } }
@media (max-width: 820px) { .fed { grid-template-columns: 1fr; gap: 40px; } .fed-map { order: -1; } }

/* ---------- communities ---------- */
.comm-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 20px; }
.comm-single { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-top: 48px; align-items: stretch; }
.comm-feature { display: flex; flex-direction: column; padding: 30px 30px 28px; }
.comm-feature .top { display: flex; align-items: center; justify-content: space-between; }
.comm-logo { height: 46px; width: auto; }
.comm-feature h4 { font-family: var(--font-display); font-weight: 700; font-size: 26px; margin: 20px 0 12px; }
.comm-feature p { margin: 0 0 22px; font-size: 15.5px; color: var(--ink-soft); line-height: 1.85; }
.comm-cta { margin-top: auto; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--latte-deep); }
.comm-feature:hover { transform: translateY(-3px); border-color: var(--t-accent); box-shadow: 0 22px 44px -30px rgba(42,40,36,.4); }
.comm-feature:hover .comm-cta { color: var(--t-accent); }
.comm-soon { background: var(--paper-2); border: 1px dashed var(--line); border-radius: var(--r-md); padding: 28px 26px; display: flex; flex-direction: column; justify-content: center; }
.soon-label { font-size: 14px; color: var(--crema); letter-spacing: .18em; text-transform: uppercase; margin: 0 0 12px; }
.comm-soon p:last-child { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.85; }
@media (max-width: 720px) { .comm-single { grid-template-columns: 1fr; } }

/* server spec card */
.spec-card { padding: 30px 32px 14px; }
.spec-title { font-size: 15px; color: var(--latte-deep); letter-spacing: .06em; margin: 0 0 6px; }
.spec-list { list-style: none; padding: 0; margin: 22px 0 0; }
.spec-list li { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); font-size: 14.5px; }
.spec-list li:last-child { border-bottom: 0; }
.spec-list li span:first-child { color: var(--muted); white-space: nowrap; }
.spec-list li span:last-child { color: var(--ink); font-weight: 500; }

/* ---------- rules / code of conduct ---------- */
.rules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 34px 56px; margin-top: 54px; }
.rule-item { display: flex; gap: 20px; }
.rule-item .rk { font-family: var(--font-latin); font-style: italic; font-size: 28px; color: var(--crema); line-height: 1; min-width: 34px; }
.rule-item h4 { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin: 0 0 8px; }
.rule-item p { margin: 0; font-size: 14.5px; color: #bdb39f; line-height: 1.8; }
.dark-sec .rule-item h4 { color: #f3ecdb; }
@media (max-width: 720px) { .rules { grid-template-columns: 1fr; gap: 30px; } }

/* ---------- server / operator info ---------- */
.server { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.stat { background: var(--card); padding: 26px 24px; }
.stat .v { font-family: var(--font-display); font-weight: 900; font-size: 38px; color: var(--ink); line-height: 1; letter-spacing: -.01em; }
.stat .v small { font-size: 18px; color: var(--latte); font-weight: 700; }
.stat .l { font-size: 13px; color: var(--muted); margin-top: 9px; }
@media (max-width: 820px) { .server { grid-template-columns: 1fr; gap: 40px; } }

/* ---------- final CTA / footer ---------- */
.final-cta { text-align: center; padding: 110px 0; }
.final-cta h2 { font-family: var(--font-display); font-weight: 900; font-size: clamp(34px, 5.2vw, 68px); line-height: 1.18; letter-spacing: -.01em; }
.final-cta h2 .em { font-family: var(--font-hand); color: var(--crema); font-weight: 600; }
.footer { border-top: 1px solid rgba(255,255,255,.12); padding: 42px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 18px; font-size: 13.5px; color: #a89e8d; }
.footer .brand-logo { height: 36px; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a:hover { color: var(--crema); }

/* ============================================================
   Thread Mock (Lemmy-style)
   ============================================================ */
.thread {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 30px 70px -44px rgba(42,40,36,.5);
}
.thread-bar { display: flex; align-items: center; gap: 9px; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); background: var(--paper-2); }
.thread-bar .dots { display: flex; gap: 6px; }
.thread-bar .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.thread-bar .url { font-family: ui-monospace, "SF Mono", monospace; font-size: 12px; color: var(--muted); margin-left: 6px; }
.thread-bar .url b { color: var(--latte-deep); font-weight: 600; }

.post { display: flex; gap: 0; padding: 0; }
.votes { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 14px; background: var(--paper-2); border-right: 1px solid var(--line-soft); min-width: 60px; }
.vote-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: var(--card);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: all .15s;
  font-size: 14px;
  padding: 0;
}
.vote-btn:hover { border-color: var(--t-accent); color: var(--t-accent); }
.vote-btn.on { background: var(--t-accent); border-color: var(--t-accent); color: #fff; }
.vote-btn.dn.on { background: var(--ink); border-color: var(--ink); }
.vote-count { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink); }

.post-body { padding: 20px 24px; flex: 1; min-width: 0; }
.post-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.post-meta > span { white-space: nowrap; }
.post-meta .c { color: var(--latte-deep); font-weight: 600; }
.post-meta .u { color: var(--ink-soft); }
.post-meta .sep { opacity: .5; }
.post h3 { font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1.4; margin: 0 0 12px; }
.post p { margin: 0 0 14px; font-size: 14.5px; color: var(--ink-soft); line-height: 1.85; }
.post-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pa { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 6px 12px; border-radius: 8px; cursor: pointer; transition: background .15s, color .15s; }
.pa:hover { background: var(--paper-2); color: var(--latte-deep); }

.comments { border-top: 1px solid var(--line-soft); padding: 8px 24px 22px; }
.comment { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.comment:last-child { border-bottom: 0; }
.comment.nested { margin-left: 28px; padding-left: 20px; border-left: 2px solid var(--line-soft); border-bottom: 0; }
.c-head { display: flex; align-items: center; gap: 9px; font-size: 12.5px; margin-bottom: 7px; }
.c-head .av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 11px; color: #fff; }
.c-head .name { font-weight: 600; color: var(--ink); font-size: 13px; }
.c-head .time { color: var(--muted); }
.c-head .op { font-size: 10px; background: var(--accent-tint); color: var(--latte-deep); padding: 1px 7px; border-radius: 6px; font-weight: 600; }
.comment p { margin: 0 0 8px; font-size: 14px; color: var(--ink-soft); line-height: 1.78; }
.c-actions { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); }
.c-vote { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.c-vote:hover { color: var(--t-accent); }
.c-vote.on { color: var(--latte-deep); font-weight: 600; }
.c-reply { cursor: pointer; }
.c-reply:hover { color: var(--latte-deep); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 820px) {
  .wrap { padding: 0 22px; }
  .nav-links { display: none; }
  .section-pad { padding: 72px 0; }
}
@media (max-width: 760px) {
  .heroA { padding: 66px 0 72px; }
  .heroA h1 { font-size: clamp(36px, 9vw, 56px); }
  .cta-row { gap: 10px; }
  .cta-row .btn { padding: 12px 20px; font-size: 15px; }
  .quote-mark { font-size: 64px; height: 20px; margin-top: 8px; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .nav-inner { height: 64px; }
  .brand { gap: 8px; }
  .brand-logo { height: 38px; }
  .brand-text { font-size: 18px; }
  .section-pad { padding: 56px 0; }
  .cta-row { justify-content: center; }
  .hero-tags { justify-content: center; }
}
