/* =========================================================================
   Felix Ast — personal site
   Shared styles. Recreated faithfully from the Claude Design prototypes.
   Palette: deep navy night -> gold daylight. Newsreader + Hanken Grotesk.
   ========================================================================= */

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

html { scroll-behavior: smooth; }
html, body { overflow-x: clip; }

body {
  margin: 0;
  background: #050b14;
  color: #f2e9da;
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
}

/* ---- Keyframes (shared) ------------------------------------------------- */
@keyframes floatUp   { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes glowPulse { 0%, 100% { opacity: .5; } 50% { opacity: .95; } }
@keyframes cueBob    { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }
@keyframes orbSpin   { to { transform: rotate(360deg); } }
@keyframes twinkle      { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }
@keyframes twinkleGold  { 0%, 100% { opacity: .78; text-shadow: 0 0 0 rgba(224,164,88,0); } 50% { opacity: 1; text-shadow: 0 0 22px rgba(224,164,88,.35); } }

.twinkle      { color: #f2e9da; animation: twinkle 6s ease-in-out infinite; }
.twinkle-gold { color: #e0a458; font-style: italic; animation: twinkleGold 4.8s ease-in-out infinite; }

/* ---- Scroll reveal ----------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 1.1s ease, transform 1.1s cubic-bezier(.16, 1, .3, 1);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---- Nav link underline ------------------------------------------------ */
.navlink { position: relative; }
.navlink::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 1px;
  background: currentColor;
  transition: width .35s ease;
}
.navlink:hover::after { width: 100%; }

/* =========================================================================
   LANDING PAGE
   ========================================================================= */

/* Project cards */
.pcard {
  transition: transform .5s cubic-bezier(.16, 1, .3, 1), box-shadow .5s ease, border-color .5s ease, background .5s ease;
}
.pcard:hover {
  transform: translateY(-8px);
  box-shadow: 0 32px 64px rgba(0, 0, 0, .45), 0 18px 60px -8px rgba(224, 164, 88, .5);
  border-color: rgba(224, 164, 88, .6) !important;
  background: linear-gradient(160deg, #15273e, #0f1c2f) !important;
}
.pcard:hover .pglow { opacity: 1 !important; transform: scale(1.25); }

/* Blog cards (cream daylight list — homepage + archive) */
.bcard {
  display: block; text-decoration: none;
  border-top: 1px solid rgba(60, 42, 16, .16);
  padding: 32px 16px; border-radius: 8px;
  transition: transform .45s cubic-bezier(.16, 1, .3, 1), background .45s ease;
}
.bcard:hover { transform: translateX(8px); background: rgba(70, 48, 16, .05); }
.bcard-last { border-bottom: 1px solid rgba(60, 42, 16, .16); }
.bcard-meta { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.bcard-no { font-family: 'Newsreader', serif; color: #b9772b; font-size: 15px; }
.bcard-date { color: #74664c; font-size: 13px; letter-spacing: .08em; }
.bcard-title { font-family: 'Newsreader', serif; font-weight: 400; font-size: 30px; color: #262014; margin: 8px 0 0; }
.bcard-sum { color: #473d28; font-size: 16px; line-height: 1.65; margin: 8px 0 0; max-width: 640px; }
.bcard-cta { display: inline-block; color: #b9772b; font-size: 14px; font-weight: 600; margin-top: 16px; }

/* Buttons */
.btnp { transition: transform .35s ease, box-shadow .35s ease; }
.btnp:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(224, 164, 88, .4); }
.btng { transition: border-color .35s ease; }
.btng:hover { border-color: rgba(242, 233, 218, .6) !important; }

/* Back-to-top button (landing + about) */
.scrolltop {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(224, 164, 88, .4);
  background: rgba(8, 17, 29, .8); backdrop-filter: blur(8px);
  color: #e0a458; font-size: 18px; cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 28px -8px rgba(0, 0, 0, .6);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: background .25s ease, color .25s ease, transform .25s ease, opacity .25s ease;
}
.scrolltop.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.scrolltop:hover { background: #e0a458; color: #050b14; transform: translateY(-2px); }

/* Blog archive search field */
.blogsearch {
  width: 100%; box-sizing: border-box;
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(60, 42, 16, .22); border-radius: 100px;
  color: #262014; font-family: 'Hanken Grotesk', sans-serif; font-size: 16px;
  padding: 15px 24px; outline: none;
  transition: border-color .3s ease, background .3s ease;
}
.blogsearch:focus { border-color: #b9772b; background: rgba(255, 255, 255, .75); }
.blogsearch::placeholder { color: #9a8c6e; }

/* About page extras */
.factcard { transition: transform .45s cubic-bezier(.16,1,.3,1), border-color .45s ease, background .45s ease; }
.factcard:hover { transform: translateY(-6px); border-color: rgba(224,164,88,.5) !important; background: rgba(224,164,88,.04) !important; }
.portrait-wrap .portrait-ring { transition: transform 1.1s cubic-bezier(.33,0,.2,1); }

/* Form fields (landing contact) */
.fin {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(242, 233, 218, .25);
  color: #f2e9da;
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 17px;
  padding: 16px 0;
  outline: none;
  transition: border-color .35s ease;
}
.fin:focus { border-color: #e0a458; }
.fin::placeholder { color: #5a6472; }
textarea.fin { resize: vertical; min-height: 96px; }

/* =========================================================================
   ARTICLE PAGE — themeable (light / dark)
   ========================================================================= */
.theme-dark {
  --bg: #050b14; --panel: #08111d; --text: #f2e9da; --muted: #9aa3b2; --faint: #7d8794;
  --body: #cdc6b6; --line: rgba(242,233,218,.12); --track: rgba(242,233,218,.1);
  --navbg: rgba(5,11,20,.6); --navline: rgba(242,233,218,.08); --btnborder: rgba(242,233,218,.3);
  --gold: #e0a458; --glow: rgba(224,164,88,.18); --dot: #3f4855; --field: rgba(242,233,218,.04);
  --barfrom: #e0a458; --barto: #569aa0;
}
.theme-light {
  --bg: #f3ebdd; --panel: #ece2cf; --text: #23190c; --muted: #594f3c; --faint: #7c6f57;
  --body: #3a3019; --line: rgba(40,28,10,.16); --track: rgba(40,28,10,.12);
  --navbg: rgba(247,240,227,.82); --navline: rgba(40,28,10,.1); --btnborder: rgba(40,28,10,.26);
  --gold: #a4661f; --glow: rgba(214,150,70,.3); --dot: #c3b59a; --field: rgba(40,28,10,.04);
  --barfrom: #b9772b; --barto: #2c7b82;
}

.iconbtn {
  background: transparent; border: none; padding: 0; cursor: pointer;
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  line-height: 1; transition: color .3s ease, transform .2s ease;
}
.iconbtn:hover { color: var(--gold); transform: translateY(-1px); }
.iconbtn:active { transform: scale(.9); }

.bmk .bmkpath { fill: none; transition: fill .25s ease; }
.bmk.saved { color: var(--gold); }
.bmk.saved .bmkpath { fill: currentColor; }

/* Comment fields */
.cin {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 16px;
  padding: 12px 0;
  outline: none;
  transition: border-color .3s ease;
}
.cin:focus { border-bottom-color: var(--gold); }
.cin::placeholder { color: var(--faint); }
textarea.cin { resize: vertical; min-height: 84px; }

.postbtn { transition: transform .25s ease, box-shadow .25s ease, opacity .25s ease; }
.postbtn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -8px var(--gold); }

.storynav { transition: border-color .3s ease, transform .3s ease, background .3s ease; }
.storynav:hover { border-color: var(--gold) !important; transform: translateY(-3px); background: var(--field); }

/* Floating action button cluster */
.fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  display: flex; flex-direction: column-reverse; align-items: center; gap: 9px;
}
.fab-trigger {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--gold); color: var(--bg); font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px -6px rgba(0, 0, 0, .5); transition: transform .35s ease;
}
.fab:hover .fab-trigger, .fab:focus-within .fab-trigger { transform: rotate(90deg); }
.fab-action {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); cursor: pointer;
  background: var(--panel); color: var(--text);
  display: flex; align-items: center; justify-content: center; line-height: 1;
  opacity: 0; transform: translateY(14px) scale(.85); pointer-events: none;
  transition: opacity .3s ease, transform .3s ease, background .25s ease, color .25s ease, border-color .25s ease;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .45);
}
.fab:hover .fab-action, .fab:focus-within .fab-action { opacity: 1; transform: none; pointer-events: auto; }
.fab-action:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.fab-action .bmkpath { fill: none; transition: fill .25s ease; }
.fab-action.bmk.saved { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.fab-action.bmk.saved .bmkpath { fill: currentColor; }

/* Article body typography */
.article-body p {
  color: var(--body); font-size: 19px; line-height: 1.85; margin: 0 0 26px;
  transition: color .5s ease;
}
.article-body p:first-of-type::first-letter {
  font-family: 'Newsreader', serif; font-size: 74px; float: left; line-height: .78;
  padding: 8px 14px 0 0; color: var(--gold); font-weight: 400;
}
.article-body h2 {
  font-family: 'Newsreader', serif; font-weight: 400; font-size: 32px; color: var(--text);
  margin: 48px 0 18px; letter-spacing: -.01em; transition: color .5s ease;
}
.article-body blockquote {
  margin: 40px 0; padding: 6px 0 6px 28px; border-left: 2px solid var(--gold);
  font-family: 'Newsreader', serif; font-style: italic; font-size: 26px; line-height: 1.4;
  color: var(--text); transition: color .5s ease;
}

/* Comment list item built by JS */
.comment-item { display: flex; gap: 16px; padding: 26px 4px; border-top: 1px solid var(--line); }
.comment-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--gold); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Newsreader', serif; font-size: 19px;
}
.comment-meta { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.comment-name { font-family: 'Newsreader', serif; font-size: 17px; color: var(--text); }
.comment-date { color: var(--faint); font-size: 13px; }
.comment-text { color: var(--body); font-size: 16px; line-height: 1.65; margin: 6px 0 0; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 860px) {
  .nav-center { display: none !important; }
}
@media (max-width: 720px) {
  .projects-grid { grid-template-columns: 1fr !important; }
  .contact-row { grid-template-columns: 1fr !important; }
  .storynav-grid { grid-template-columns: 1fr !important; }
  .nav-inner { padding: 20px 24px !important; }
  .nav-links { gap: 18px !important; }
  .about-hero { grid-template-columns: 1fr !important; gap: 40px !important; text-align: center; }
  .facts-grid { grid-template-columns: 1fr !important; }
  .about-path { grid-template-columns: 1fr !important; gap: 40px !important; }
}
