/* avenpa — dark editorial, black primary. Fraunces serif + Inter. No orange. */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces.ttf") format("truetype");
  font-weight:100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces-Italic.ttf") format("truetype");
  font-weight:100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter.ttf") format("truetype");
  font-weight:100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #050505;
  --bg-soft: #0c0c0c;
  --surface: #111111;
  --ink: #f2f2f0;
  --ink-soft: #cfcfcc;
  --muted: #8f8f8b;
  --faint: #565652;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mx: 50%;
  --my: 50%;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--ink); color: var(--bg); }

/* ---------- ambient mouse spotlight ---------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(560px circle at var(--mx) var(--my), rgba(255,255,255,0.055), transparent 62%);
  transition: background 0.4s ease;
}

/* ---------- film grain ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- header ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(5, 5, 5, 0.72);
  backdrop-filter: saturate(140%) blur(18px);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  height: 56px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1;
  margin-right: auto;
}
.nav-links { display: flex; gap: 30px; }
.nav-links a {
  position: relative;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted);
  transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 0; height: 1px;
  background: var(--ink);
  transition: width 0.25s ease;
}
.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after { width: 100%; }
.nav-links a[aria-current="page"] { color: var(--ink); }

/* header right-side actions (start + auth icon) */
.nav-actions { display: flex; align-items: center; gap: 10px; }

/* start button in header — small (two-class specificity beats the .btn base) */
.btn.btn-start {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  min-height: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 980px;
  line-height: 1.3;
  background: var(--ink);
  color: #050505;
  border: 1px solid var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn.btn-start:hover { background: #ffffff; border-color: #ffffff; }
.btn.btn-start-ghost {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  min-height: 0;
  font-size: 12px;
  font-weight: 500;
  border-radius: 980px;
  line-height: 1.3;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: transparent;
  transition: border-color 0.15s ease;
}
.btn.btn-start-ghost:hover { border-color: var(--ink); }

/* auth icon: red = logout (signed in), white = login (signed out) */
.auth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.auth-icon svg { width: 15px; height: 15px; }
.auth-icon.logout { color: #e5484d; border: 1px solid rgba(229, 72, 77, 0.5); }
.auth-icon.logout:hover { background: rgba(229, 72, 77, 0.14); border-color: #e5484d; }
.auth-icon.login { color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.55); }
.auth-icon.login:hover { background: rgba(255, 255, 255, 0.12); border-color: #ffffff; }

/* learn search */
.search-wrap { margin: 4px 0 8px; }
.search-input {
  width: 100%;
  max-width: 360px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.15s ease;
}
.search-input:focus { border-color: var(--line-strong); }
.search-input::placeholder { color: var(--faint); }
.search-empty {
  color: var(--faint);
  font-size: 15px;
  font-style: italic;
  padding: 24px 4px;
}

/* link cards + form */
.link-url {
  font-size: 13px;
  color: var(--faint);
  word-break: break-all;
  margin-top: 8px !important;
}
.link-form {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.link-form input[type="text"] {
  flex: 1;
  min-width: 160px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  outline: none;
}
.link-form input:focus { border-color: var(--line-strong); }

/* ---------- shared ---------- */
main { position: relative; z-index: 1; max-width: 1160px; margin: 0 auto; padding: 0 28px; }

.eyebrow {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--line-strong);
}

/* ---------- hero ---------- */
.hero {
  padding: clamp(110px, 16vh, 180px) 0 clamp(88px, 12vh, 140px);
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(52px, 8.8vw, 112px);
  line-height: 0.98;
  letter-spacing: -0.03em;
}
.hero h1 em {
  font-style: italic;
  font-weight: 350;
}
.hero .sub {
  max-width: 36em;
  margin-top: 34px;
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 400;
  color: var(--muted);
  line-height: 1.7;
}
.hero-actions { margin-top: 48px; display: flex; gap: 16px; flex-wrap: wrap; }

/* typewriter word */
.typeword {
  display: inline-block;
  position: relative;
}
.typeword .caret {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  background: var(--ink);
  margin-left: 4px;
  vertical-align: -0.06em;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- buttons (magnetic) ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 14px 30px;
  border-radius: 980px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  min-height: 48px;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  will-change: transform;
}
.btn-solid { background: var(--ink); color: #050505; }
.btn-solid:hover { background: #ffffff; }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }

/* ---------- sections ---------- */
.section {
  padding: clamp(72px, 10vw, 128px) 0;
  border-bottom: 1px solid var(--line);
}
.section h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(34px, 5vw, 58px);
  letter-spacing: -0.02em;
  line-height: 1.08;
}
.lede {
  max-width: 36em;
  margin-top: 20px;
  font-size: 16.5px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.75;
}

/* ---------- reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- marquee ---------- */
.marquee {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  white-space: nowrap;
}
.marquee-track {
  display: inline-block;
  animation: scroll-x 30s linear infinite;
}
.marquee span {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  font-weight: 400;
  color: var(--muted);
  margin: 0 28px;
}
.marquee span.dot { color: var(--faint); }
@keyframes scroll-x {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---------- learn (post list) ---------- */
.post-toolbar { margin-top: 8px; }
.btn-newpost { min-height: 40px; padding: 10px 20px; font-size: 14px; }
.post-list { margin-top: 24px; }
.post {
  display: flex;
  align-items: baseline;
  gap: 22px;
  padding: 26px 4px;
  border-top: 1px solid var(--line);
  transition: padding-left 0.2s ease;
}
.post:last-child,
.post-item:last-child .post { border-bottom: 1px solid var(--line); }
.post:hover { padding-left: 12px; }
.post-date {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--faint);
  min-width: 116px;
}
.post-title { font-size: 17px; font-weight: 400; color: var(--ink-soft); }
.post-arrow { margin-left: auto; color: var(--faint); transition: color 0.2s ease, transform 0.2s ease; }
.post:hover .post-arrow { color: var(--ink); transform: translateX(4px); }

/* inline edit controls next to each post */
.post-edit {
  display: flex;
  gap: 8px;
  margin: -14px 0 14px 4px;
}
.post-edit:empty { display: none; }
.post-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.post-icon .icon { width: 16px; height: 16px; }
.post-icon:hover { color: var(--ink); border-color: var(--ink); }
.post-icon.post-del.confirm {
  color: #e05a5a;
  border-color: #e05a5a;
  background: rgba(224,90,90,0.12);
  width: auto;
  padding: 0 12px;
  font-size: 13px;
}

/* ---------- service cards ---------- */
.service-grid {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.service {
  position: relative;
  overflow: hidden;
  padding: 36px 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.service:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.service::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(320px circle at var(--mx) var(--my), rgba(255,255,255,0.10), transparent 65%);
  pointer-events: none;
}
.service:hover::before { opacity: 1; }
.service-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--faint);
}
.service h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 25px;
  margin-top: 16px;
  letter-spacing: -0.01em;
}
.service p {
  margin-top: 12px;
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.7;
}

/* service illustration (SVG stroke-draw) */
.service-illo {
  display: block;
  width: 100%;
  height: 110px;
  margin-bottom: 22px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.service-illo .stroke {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
}
.service-illo .fill {
  fill: var(--ink);
  opacity: 0;
}
.service.in .service-illo .stroke { animation: draw 1.6s ease forwards; }
.service.in .service-illo .fill { animation: fadein 0.6s ease 1.2s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 0.14; } }

/* ---------- process steps ---------- */
.steps {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.step {
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--ink);
  border-radius: 0 0 16px 16px;
  background: var(--surface);
}
.step h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 24px;
  margin-top: 14px;
  letter-spacing: -0.01em;
}
.step p {
  margin-top: 10px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- article ---------- */
.article { padding-top: clamp(72px, 9vw, 112px); }
.article-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(36px, 5.4vw, 62px);
  line-height: 1.06;
  letter-spacing: -0.02em;
}
.article-date {
  font-family: var(--serif);
  font-style: italic;
  color: var(--faint);
  margin-top: 16px;
}
.article-body {
  margin-top: 40px;
  max-width: 42em;
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink-soft);
}
.article-body h1, .article-body h2, .article-body h3 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 400;
  margin: 1.6em 0 0.6em;
  line-height: 1.2;
}
.article-body h1 { font-size: 1.9em; }
.article-body h2 { font-size: 1.5em; }
.article-body h3 { font-size: 1.2em; }
.article-body p { margin: 1em 0; }
.article-body ul, .article-body ol { margin: 1em 0; padding-left: 1.4em; }
.article-body li { margin: 0.4em 0; }
.article-body blockquote {
  border-left: 2px solid var(--line-strong);
  padding-left: 18px;
  margin: 1.4em 0;
  color: var(--muted);
  font-style: italic;
}
.article-body code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
.article-body pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  overflow-x: auto;
  margin: 1.4em 0;
}
.article-body pre code { background: none; padding: 0; }
.article-body hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
.article-body a { border-bottom: 1px solid var(--line-strong); }

/* ---------- contact ---------- */
.contact-row { margin-top: 48px; }
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 300;
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 8px;
  transition: border-color 0.2s ease, letter-spacing 0.25s ease;
}
.contact-link:hover { border-color: var(--ink); letter-spacing: 0.01em; }

/* ---------- login (Google-style, standalone page) ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-shell { max-width: 420px; width: 100%; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 44px 40px;
  text-align: center;
}
.login-brand {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.login-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 28px;
  letter-spacing: -0.02em;
}
.login-sub { color: var(--muted); font-size: 14.5px; margin-top: 8px; }
.login-form { margin-top: 32px; display: flex; flex-direction: column; gap: 12px; }
.login-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease;
}
.login-input:focus { border-color: var(--ink); }
.login-btn { justify-content: center; width: 100%; border-radius: 12px; }
.login-err { color: #e05a5a; font-size: 14px; margin-top: 12px; }
.login-ip { margin-top: 18px; font-size: 13px; color: var(--faint); }
.login-ip code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
  background: var(--bg-soft);
  padding: 2px 7px;
  border-radius: 5px;
}

/* ---------- admin ---------- */
.admin-form { margin-top: 32px; max-width: 640px; }
.admin-form label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}
.admin-form .hint { color: var(--faint); font-weight: 400; margin-left: 8px; }
.admin-form input[type="text"],
.admin-form textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-family: var(--sans);
  outline: none;
}
.admin-form textarea { resize: vertical; white-space: pre; line-height: 1.6; }
.admin-form input:focus, .admin-form textarea:focus { border-color: var(--line-strong); }
.admin-actions { display: flex; gap: 12px; }
.admin-list { margin-top: 24px; }
.admin-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 4px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.admin-row:last-child { border-bottom: 1px solid var(--line); }
.admin-title { flex: 1; color: var(--ink-soft); }
.admin-date { color: var(--faint); font-size: 13px; }
.admin-row button {
  padding: 6px 14px;
  border-radius: 980px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.admin-row button:hover { color: var(--ink); border-color: var(--ink); }
.admin-row .admin-del:hover { color: #e05a5a; border-color: #e05a5a; }
.admin-row .admin-del.confirm { color: #e05a5a; border-color: #e05a5a; background: rgba(224,90,90,0.1); }

/* ---------- footer ---------- */
.foot {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 48px 28px 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--faint);
}
.foot .brand { font-size: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .nav-inner { padding: 0 16px; height: 54px; gap: 16px; }
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 13px; }
  .btn.btn-start, .btn.btn-start-ghost { padding: 4px 11px; font-size: 11.5px; }
  .auth-icon { width: 28px; height: 28px; }
  .auth-icon svg { width: 14px; height: 14px; }
  main { padding: 0 16px; }
  .hero { padding: 80px 0 72px; }
  .service-grid { grid-template-columns: 1fr; gap: 14px; }
  .steps { grid-template-columns: 1fr; gap: 12px; }
  .post { flex-wrap: wrap; gap: 6px 22px; }
  .post-date { min-width: 0; }
  .foot { flex-direction: column; gap: 12px; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .post, .service, .nav-links a, .contact-link { transition: none; }
  .reveal { opacity: 1; transform: none; }
  .ambient { display: none; }
  .marquee-track, .typeword .caret { animation: none; }
  .service-illo .stroke { stroke-dashoffset: 0; }
  .service-illo .fill { opacity: 0.14; }
}
