@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,700..900&family=Nunito:wght@400;600;700&family=IBM+Plex+Mono:wght@400;600&display=swap");

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; display: block; }


/* ========== Light theme (default) ========== */
:root {
  /* Palette #2 — Energetic & Lighthearted */
  --header-bg: color-mix(in hsl, var(--surface) 96%, transparent);
  --header-border: rgba(15,23,42,.10);
  --header-shadow-1: 0 8px 24px rgba(15,23,42,.10);
  --header-shadow-2: 0 1px 0 rgba(15,23,42,.06);

  --bg: #FFF7ED;
  --surface: #FFFFFF;
  --card: #FFFFFF;

  --text: #334155;
  --text-strong: #0F172A;
  --muted: #64748B;

  --accent: #2563EB;
  --accent-2: #38BDF8;
  --brand: #FB923C;

  --ring: color-mix(in hsl, var(--accent) 60%, white);
  --radius: 16px;
  --container: 1100px;

  --font-serif: "Fraunces", ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --font-sans: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* ========== Base ========== */
body {
  font-family: var(--font-sans);
  color: var(--text);
  line-height: 1.6;
  transition: background-color .25s ease, color .25s ease;
  background: var(--bg);   /* keep base color; gradient is now on ::before */
}

h1, h2, h3 {
  color: var(--text-strong);
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin: 40px 0 16px;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

.container { max-width: var(--container); margin-inline: auto; padding: 24px; }

/* ========== Header (full width bg, centered inner row) ========== */
.site-header {
  position: sticky; top: 0; z-index: 20; width: 100%;
  background: color-mix(in hsl, var(--surface) 78%, transparent);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--header-shadow-1), var(--header-shadow-2);
  backdrop-filter: blur(10px) saturate(1.05);
  
}
.site-header > .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px; min-height: 60px; box-sizing: border-box;
}
.site-header::after{
  content:"";
  position:absolute; left:0; right:0; bottom:-10px; height:10px;
  pointer-events:none;
  background: linear-gradient(to bottom, rgba(0,0,0,.10), transparent);
  opacity:.18;
}

.brand { font-size: 1.25rem; font-weight: 800; letter-spacing: .5px; color: var(--text-strong); }
.brand .dot { color: var(--brand); }

.site-nav { display: flex; align-items: center; gap: 18px; }
.site-nav a { color: var(--text); opacity: .9; }
.site-nav a:hover {
  color: var(--accent); opacity: 1;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px;
}

.nav-toggle { display: none; background: none; border: 1px solid rgba(255,255,255,0.2); padding: 6px 10px; border-radius: 10px; color: var(--text); }

/* Theme toggle button (hover/active + high-contrast border) */
.theme-toggle{
  margin-left: 6px; padding: 6px 10px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid rgba(0,0,0,.4);
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible{
  background: color-mix(in hsl, var(--accent) 15%, transparent);
  box-shadow: 0 0 6px rgba(37,99,235,.4);
  border-color: rgba(0,0,0,.6);
}
.theme-toggle:active{
  transform: scale(.9);
  box-shadow: 0 0 12px var(--accent);
}

/* ========== Hero ========== */
.hero { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 24px; align-items: center; min-height: 55vh; }
.hero__text h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; margin: 0 0 12px; }
.hero__text p { color: var(--muted); opacity: .95; }
.hero__media { justify-self: end; }

/* ========== Buttons ========== */
.btn{
  display:inline-block; padding:10px 18px; border-radius:10px; font-weight:600; color:#fff;
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in hsl, var(--accent) 90%, white) 100%);
  box-shadow: 0 4px 12px rgba(37,99,235,.25);
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37,99,235,.35);
  background: linear-gradient(135deg, color-mix(in hsl, var(--accent) 95%, white), var(--accent));
}
.btn--ghost{
  background: transparent; color: var(--accent); border: 2px solid var(--accent); box-shadow: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn--ghost:hover{ background: rgba(37,99,235,.08); }

.cta-row{ display:flex; gap:12px; margin-top:14px; }

/* ========== Cards & grids ========== */
.grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }

.card{
  background: var(--surface);
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 12px 32px rgba(15,23,42,.10);
}
.card__link{ display:inline-block; margin-top:8px; color:var(--brand); font-weight:600; }
.card__link:hover{ color: color-mix(in hsl, var(--brand) 85%, var(--accent)); text-decoration: underline; text-underline-offset: 3px; }

/* ========== Responsive ========== */
@media (max-width: 860px){
  .hero{ grid-template-columns:1fr; }
  .hero__media{ justify-self:start; }
  .grid{ grid-template-columns:1fr; }

  .nav-toggle{ display:inline-block; }
  .site-nav{
    position: fixed; inset: 64px 16px auto 16px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 12px; border-radius: 12px;
    display: none; flex-direction: column; gap: 12px;
  }
  .site-nav.open{ display:flex; }
}

/* ========== Dark theme (activated by html[data-theme="dark"]) ========== */
html[data-theme="dark"]{
  --bg:#0B1220; --surface:#111827; --card:#0F172A;
  --text:#F8FAFC; --text-strong:#FFFFFF; --muted:#A5B4FC;
  --accent:#60A5FA; --accent-2:#38BDF8; --brand:#FDBA74;
  --radius:14px;
}
html[data-theme="dark"] .site-header{
  background: color-mix(in hsl, var(--surface) 85%, transparent);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
html[data-theme="dark"] .theme-toggle{ border-color: rgba(255,255,255,.4); }
html[data-theme="dark"] .theme-toggle:hover,
html[data-theme="dark"] .theme-toggle:focus-visible{ border-color: rgba(255,255,255,.6); }
html[data-theme="dark"] .btn{ box-shadow: 0 4px 14px rgba(96,165,250,.4); }
html[data-theme="dark"] .btn--ghost{
  color: var(--accent);
  border-color: color-mix(in hsl, var(--accent) 85%, black);
}
html[data-theme="dark"] .btn--ghost:hover{
  background: color-mix(in hsl, var(--accent) 18%, transparent);
}

html[data-theme="dark"]{
  --header-bg: color-mix(in hsl, var(--surface) 92%, transparent);
  --header-border: rgba(255,255,255,.10);
  --header-shadow-1: 0 10px 26px rgba(0,0,0,.45);
  --header-shadow-2: 0 1px 0 rgba(255,255,255,.06);
}
html[data-theme="dark"] .site-header::after{
  background: linear-gradient(to bottom, rgba(255,255,255,.20), transparent);
  opacity:.25;
}

/* Keep underline hover in both themes */
.site-nav a:hover,
.card__link:hover{ text-decoration: underline; text-underline-offset: 3px; }

/* ========== 3D Flip Photo ========== */
.photo-flip{
  position: relative;
  width: min(600px, 100%);
  aspect-ratio: 3 / 2;            /* adjust if your portrait is closer to 4:3 */
  perspective: 1200px;
  cursor: zoom-in;
}
.photo-flip .side{
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 18px 40px rgba(0,0,0,0.35), 0 0 18px rgba(37,99,235,0.25);
  backface-visibility: hidden; transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.photo-flip .front{ transform: rotateY(0deg); }
.photo-flip .back{
  transform: rotateY(180deg);
  object-position: center 12%;     /* bias upward to avoid head crop */
}
.photo-flip.flipped .front{ transform: rotateY(-180deg); }
.photo-flip.flipped .back{ transform: rotateY(0deg); }

/* Hover pop (both states) */
.photo-flip:hover .side{
  transform: translateZ(0) translateY(-3px) scale(1.02) rotateY(var(--ry,0deg));
  box-shadow: 0 24px 52px rgba(0,0,0,0.45), 0 0 24px rgba(37,99,235,0.35);
}
.photo-flip:hover .front{ --ry: 0deg; }
.photo-flip:hover.flipped .front{ --ry: -180deg; }
.photo-flip:hover .back{ --ry: 180deg; }
.photo-flip:hover.flipped .back{ --ry: 0deg; }

/* Dark theme tweaks for photo */
html[data-theme="dark"] .photo-flip .side{
  border: 2px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 40px rgba(0,0,0,0.6), 0 0 12px rgba(96,165,250,0.2);
}
html[data-theme="dark"] .photo-flip:hover .side{
  box-shadow: 0 24px 52px rgba(0,0,0,0.75), 0 0 24px rgba(96,165,250,0.45);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .photo-flip .side{ transition: none; }
}

/* ===== Blog list cards ===== */
.post-list{
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 16px;
}

.post-card{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;

  background: var(--surface);
  color: var(--text);
  text-decoration: none;

  border: 1px solid rgba(15,23,42,.10);
  border-radius: var(--radius);
  padding: 16px 18px;

  box-shadow: 0 10px 26px rgba(15,23,42,.10);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}

.post-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(15,23,42,.16);
  border-color: color-mix(in hsl, var(--accent) 30%, rgba(15,23,42,.12));
}

.post-card:focus-visible{
  outline: 3px solid color-mix(in hsl, var(--accent) 55%, white);
  outline-offset: 2px;
}

.post-card__title{
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--text-strong);
}

.post-card__date{
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Dark theme tune-up */
html[data-theme="dark"] .post-card{
  border-color: rgba(255,255,255,.10);
  box-shadow: 0 12px 28px rgba(0,0,0,.45);
}
html[data-theme="dark"] .post-card:hover{
  border-color: color-mix(in hsl, var(--accent) 45%, rgba(255,255,255,.12));
  box-shadow: 0 16px 34px rgba(0,0,0,.6);
}

/* Optional: give single post pages a card too */
.post{
  max-width: 70ch;
  background: var(--surface);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 12px 30px rgba(15,23,42,.12);
}
html[data-theme="dark"] .post{
  border-color: rgba(255,255,255,.10);
  box-shadow: 0 14px 34px rgba(0,0,0,.55);
}
.post h1 { margin-bottom: .25rem; }
.post img { border-radius: 12px; margin: 1rem 0; }
