/* ==========================================================
   Adithya Ramesh — personal site
   Clean modern sans + mono details. Cream by day, charcoal by night.
   ========================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #fffee4;
  --bg-translucent: rgba(255, 254, 228, 0.82);
  --surface: #fbf9d9;
  --border: #e6e3bf;
  --text: #23231b;
  --muted: #6f6e5c;
  --accent: #2450c8;
  --accent-hover: #1a3da0;
  --accent-soft: rgba(36, 80, 200, 0.09);
  --shadow: 0 1px 2px rgba(35, 35, 27, 0.05), 0 8px 24px rgba(35, 35, 27, 0.05);

  --font-sans: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas,
    monospace;

  --w-content: 52rem; /* ~832px */
  --header-h: 4rem;
}

[data-theme="dark"] {
  --bg: #1f1f20;
  --bg-translucent: rgba(31, 31, 32, 0.82);
  --surface: #28282a;
  --border: #3a3a3d;
  --text: #edece1;
  --muted: #9c9b90;
  --accent: #8aa9ff;
  --accent-hover: #aec3ff;
  --accent-soft: rgba(138, 169, 255, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s ease, color 0.35s ease;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

img { max-width: 100%; display: block; }

.container {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 100;
  background: var(--bg-translucent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; color: var(--text); }
.logo:hover { text-decoration: none; color: var(--accent); }
.logo .dot { color: var(--accent); }
.logo-img { height: 26px; width: auto; display: block; }

.site-nav { display: flex; align-items: center; gap: 1.4rem; }
.site-nav a { color: var(--muted); font-size: 0.92rem; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); text-decoration: none; }

.theme-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Sections ---------- */
main { padding-top: var(--header-h); flex: 1; }
.section { padding: 4.5rem 0 1rem; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}
.eyebrow::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.eyebrow[data-num]::before {
  content: attr(data-num);
  color: var(--accent);
  opacity: 0.55;
  margin-right: 0.65rem;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 1rem; }
h2 { font-size: 1.55rem; font-weight: 700; }
.muted { color: var(--muted); }

/* ---------- Hero ---------- */
.hero { padding: 6.5rem 0 1.5rem; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 3.4rem); font-weight: 700; margin-bottom: 1.2rem; }
.hero .intro { max-width: 48rem; font-size: 1.15rem; margin: 0 0 1.6rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.hero-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: start; }
@media (min-width: 680px) {
  .hero-grid { grid-template-columns: 1fr 12rem; gap: 3rem; }
}
.hero-photo {
  width: 12rem; height: 14rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 2.4rem; font-weight: 600; color: var(--accent);
  overflow: hidden;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 679px) {
  .hero-photo { order: -1; width: 8.5rem; height: 10rem; font-size: 1.8rem; }
}

/* Hero meta row: status pill + live clock */
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; margin: 0 0 1.5rem; }
.status-pill {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.4rem 0.9rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 0.82rem; font-weight: 500;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.pulse-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.pulse-dot::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  background: var(--accent); opacity: 0.45; animation: pulse-ring 2.2s ease-out infinite;
}
@keyframes pulse-ring { 0% { transform: scale(0.6); opacity: 0.5; } 100% { transform: scale(2.4); opacity: 0; } }
.live-clock { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .pulse-dot::after { animation: none; opacity: 0.3; } }

.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 1.05rem; border-radius: 999px; border: 1px solid var(--border);
  font-size: 0.92rem; font-weight: 600; color: var(--text); background: transparent; cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--bg); }

/* ---------- Ledger ---------- */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: flex; align-items: baseline; gap: 0.9rem; padding: 0.85rem 0; }
.ledger li + li { border-top: 1px dashed var(--border); }
.ledger .key {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); white-space: nowrap; min-width: 8.5rem;
}
.ledger .leader { flex: 1; border-bottom: 1px dotted var(--border); transform: translateY(-0.3em); min-width: 1.5rem; }
.ledger .val { flex: 3; color: var(--text); }

/* ---------- Cards / writing ---------- */
.post-list { display: flex; flex-direction: column; gap: 1rem; margin: 0 0 1.75rem; }
.post-card {
  display: block; padding: 1.25rem 1.4rem; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, background-color 0.35s ease;
}
.post-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.post-card .meta {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); display: flex; gap: 0.9rem; margin-bottom: 0.35rem;
}
.post-card h3 { font-size: 1.12rem; font-weight: 700; margin: 0 0 0.3rem; }
.post-card:hover h3 { color: var(--accent); }
.post-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 640px) { .about-grid.with-photo { grid-template-columns: 9rem 1fr; align-items: start; } }
.portrait {
  width: 9rem; height: 9rem; border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 2rem; font-weight: 600; color: var(--accent); overflow: hidden;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.timeline { list-style: none; margin: 1.75rem 0 0; padding: 0; border-left: 1px solid var(--border); }
.timeline li { position: relative; padding: 0 0 1.4rem 1.4rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -4px; top: 0.5em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.timeline .when {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 0.15rem;
}
.timeline .what { font-weight: 600; }
.timeline p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- FAQ ---------- */
.faq-list { display: flex; flex-direction: column; gap: 0.75rem; margin: 0 0 1rem; }
.faq-list details {
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  transition: border-color 0.18s ease, background-color 0.35s ease;
}
.faq-list details[open] { border-color: var(--accent); }
.faq-list summary {
  cursor: pointer; list-style: none; padding: 1.05rem 1.3rem; font-weight: 600; font-size: 0.98rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; font-family: var(--font-mono); font-size: 1.1rem; color: var(--muted); flex-shrink: 0; }
.faq-list details[open] summary::after { content: "\2212"; color: var(--accent); }
.faq-list .faq-a { margin: 0; padding: 0 1.3rem 1.2rem; color: var(--muted); font-size: 0.95rem; line-height: 1.65; max-width: 42rem; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 5rem; border-top: 1px solid var(--border); padding: 3rem 0 2.5rem; }

.contact-block { margin-bottom: 2.75rem; }
.contact-block h2 { font-size: 2.15rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 0.5rem; }
.contact-block > p { color: var(--muted); margin: 0 0 1.4rem; max-width: 34rem; font-size: 1.02rem; }
.contact-links { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.footer-quote {
  max-width: 34rem; margin: 0 0 2rem; padding-left: 1.1rem; border-left: 2px solid var(--accent);
  font-size: 1rem; color: var(--text);
}
.footer-quote cite {
  display: block; margin-top: 0.4rem; font-style: normal; font-family: var(--font-mono);
  font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}

.social-links { display: flex; flex-wrap: wrap; gap: 1.4rem; margin-bottom: 2rem; }
.social-links a { color: var(--muted); font-size: 0.92rem; font-weight: 500; font-family: var(--font-mono); }
.social-links a:hover { color: var(--accent); text-decoration: none; }

.colophon { font-size: 0.82rem; color: var(--muted); font-family: var(--font-mono); }
.colophon p { margin: 0.25rem 0; }

/* ---------- Blog listing page ---------- */
.page-head {
  padding: 4.5rem 0 1.5rem; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.25rem;
}
.page-head h1 { font-size: clamp(2rem, 5vw, 2.6rem); margin: 0; }
.page-head .sub { margin: 0.5rem 0 0; color: var(--muted); }

.sort-control {
  display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
}
.sort-control select {
  appearance: none; font-family: var(--font-mono); font-size: 0.82rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.45rem 2rem 0.45rem 0.7rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.7rem center;
}
.sort-control select:hover { border-color: var(--accent); }

/* Search (blog page) */
.search-wrap { margin-bottom: 1.5rem; }
.search-wrap input {
  width: 100%; padding: 0.8rem 1.1rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font-family: var(--font-sans); font-size: 0.95rem;
  transition: border-color 0.15s ease, background-color 0.35s ease;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:hover { border-color: var(--accent); }
.search-wrap input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.search-status {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin: 0.5rem 0.2rem 0; min-height: 1em;
}

/* ---------- Project cards ---------- */
.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 0 0 1.75rem; }
@media (max-width: 620px) { .project-grid { grid-template-columns: 1fr; } }
.project-card {
  display: block; padding: 1.2rem 1.3rem; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, background-color 0.35s ease;
}
.project-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.project-card .meta {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); display: flex; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem;
}
.project-card h3 { font-size: 1.05rem; font-weight: 700; margin: 0 0 0.3rem; display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.project-card .arrow { color: var(--muted); font-weight: 400; transition: transform 0.18s ease, color 0.18s ease; }
.project-card:hover .arrow { transform: translateX(3px); color: var(--accent); }
.project-card:hover h3 { color: var(--accent); }
.project-card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

/* ---------- Article (blog post) ---------- */
.article { padding: 4rem 0 0; }
.article .back { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.06em; }
.article h1 { font-size: clamp(1.9rem, 5vw, 2.5rem); margin: 1.2rem 0 0.6rem; }
.article .meta {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 2.25rem;
}
.article-body { max-width: 40rem; }
.article-body p { margin: 0 0 1.25rem; }
.article-body h2 { font-size: 1.3rem; margin: 2.25rem 0 0.75rem; }
.article-body blockquote { margin: 1.5rem 0; padding-left: 1.1rem; border-left: 2px solid var(--accent); color: var(--muted); }
.article-body hr { border: none; border-top: 1px dashed var(--border); margin: 2.5rem 0; }

/* ---------- Resume page ---------- */
.resume-block {
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); padding: 2rem; margin-top: 1.5rem;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.resume-block h2 {
  font-size: 1.05rem; font-family: var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin: 2rem 0 1rem;
}
.resume-block h2:first-child { margin-top: 0; }
.resume-entry { margin-bottom: 1.4rem; }
.resume-entry:last-child { margin-bottom: 0; }
.resume-entry .row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; align-items: baseline; }
.resume-entry .role { font-weight: 700; }
.resume-entry .when {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.resume-entry .org { color: var(--muted); font-size: 0.95rem; }
.resume-entry ul { margin: 0.5rem 0 0; padding-left: 1.1rem; color: var(--text); font-size: 0.95rem; }
.resume-entry ul li { margin-bottom: 0.3rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.chips li { font-family: var(--font-mono); font-size: 0.78rem; padding: 0.3rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); }

/* ---------- Project detail page ---------- */
.project-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.75rem 0 2.25rem; }
.project-facts { margin: 0 0 2.25rem; border-top: 1px dashed var(--border); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .site-nav { gap: 1rem; }
  .site-nav a.hide-mobile { display: none; }
  .ledger li { flex-direction: column; gap: 0.15rem; }
  .ledger .leader { display: none; }
  .resume-block { padding: 1.4rem; }
}

/* ---------- Print: résumé page prints as a clean A4 ---------- */
@media print {
  .site-header, .site-footer, .btn, .page-head .eyebrow { display: none !important; }
  body { background: #fff !important; color: #000 !important; font-size: 10.5pt; }
  main { padding-top: 0; }
  .resume-block { border: none; background: #fff; padding: 0; }
  .page-head { padding: 0 0 0.5rem; }
  a { color: #000; text-decoration: none; }
}
