/* =========================================================
   pakdad.com — design tokens
   Edit these values to restyle the whole site.
   ========================================================= */
:root {
  --bg:            #fbfaf9;
  --bg-elevated:   #ffffff;
  --bg-sunken:     #f2efec;
  --text:          #17161a;
  --text-muted:    #66646e;
  --text-faint:    #8f8d97;
  --border:        #e6e2dd;
  --accent:        #b6431c;
  --accent-soft:   rgba(182, 67, 28, 0.09);
  --shadow-sm:     0 1px 2px rgba(23, 22, 26, 0.05);
  --shadow-md:     0 4px 6px -2px rgba(23, 22, 26, 0.05), 0 12px 28px -8px rgba(23, 22, 26, 0.10);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --shell: 1080px;
  --prose: 66ch;
  --radius: 14px;
  --radius-sm: 8px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark palette — applied by system preference unless the user forced light,
   and always when the user forced dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #111013;
    --bg-elevated: #191819;
    --bg-sunken:   #0b0a0c;
    --text:        #edeaea;
    --text-muted:  #a3a0a8;
    --text-faint:  #7c7982;
    --border:      #2a282c;
    --accent:      #ef8a5f;
    --accent-soft: rgba(239, 138, 95, 0.13);
    --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md:   0 4px 6px -2px rgba(0, 0, 0, 0.4), 0 12px 28px -8px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  --bg:          #111013;
  --bg-elevated: #191819;
  --bg-sunken:   #0b0a0c;
  --text:        #edeaea;
  --text-muted:  #a3a0a8;
  --text-faint:  #7c7982;
  --border:      #2a282c;
  --accent:      #ef8a5f;
  --accent-soft: rgba(239, 138, 95, 0.13);
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:   0 4px 6px -2px rgba(0, 0, 0, 0.4), 0 12px 28px -8px rgba(0, 0, 0, 0.5);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
img, video { height: auto; }

h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 650;
}

p { margin: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2.5rem);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease);
}
.site-header.is-stuck { border-bottom-color: var(--border); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-right: auto;
}
.brand:hover { color: var(--accent); }
/* Monogram is a mask, so it inherits the link colour in both themes. */
.brand-mark {
  width: 25px;
  height: 28px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("/assets/img/logo.svg") center / contain no-repeat;
  mask: url("/assets/img/logo.svg") center / contain no-repeat;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.18s, background-color 0.18s;
}
.site-nav a:hover { color: var(--text); background: var(--bg-sunken); }
.site-nav a[aria-current="true"] { color: var(--accent); background: var(--accent-soft); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 1.05rem; height: 1.05rem; }

.nav-toggle { display: none; }

/* Theme toggle shows the icon for the mode it will switch *to*. */
.icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun  { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
:root[data-theme="dark"]  .icon-sun  { display: block; }
:root[data-theme="dark"]  .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun  { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

@media (max-width: 780px) {
  .nav-toggle { display: inline-grid; }
  .site-nav {
    position: absolute;
    inset: 100% 0 auto;
    background: var(--bg-elevated);
    border-block: 1px solid var(--border);
    padding: 0.6rem clamp(1.15rem, 4vw, 2.5rem) 1rem;
    display: none;
  }
  .site-nav[data-open="true"] { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 0.15rem; }
  .site-nav a { padding: 0.6rem 0.85rem; }
}

/* =========================================================
   Sections
   ========================================================= */
section { scroll-margin-top: 5.5rem; }

.section {
  padding-block: clamp(3.5rem, 9vw, 6rem);
  border-top: 1px solid var(--border);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.9rem;
}
.eyebrow span { color: var(--accent); }

.section-title {
  font-size: clamp(1.6rem, 3.6vw, 2.15rem);
  margin-bottom: 0.75rem;
}

.section-intro {
  color: var(--text-muted);
  max-width: var(--prose);
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  padding-block: clamp(3rem, 9vw, 6.5rem);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(2rem, 6vw, 4rem);
}

.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  letter-spacing: -0.035em;
  margin-bottom: 0.9rem;
}
.hero h1 .surname { color: var(--text-muted); font-weight: 500; }

.hero-role {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  margin-bottom: 1.4rem;
}
.hero-role::before {
  content: "";
  width: 6px; height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  /* Keep the dot on the first line when the label wraps on narrow screens. */
  align-self: flex-start;
  margin-top: 0.55em;
}

.hero-lead {
  font-size: clamp(1.02rem, 2.2vw, 1.15rem);
  color: var(--text-muted);
  max-width: 52ch;
  margin-bottom: 1.9rem;
}
.hero-lead strong { color: var(--text); font-weight: 600; }

.hero-portrait {
  position: relative;
  width: clamp(180px, 26vw, 260px);
  flex: none;
}
.hero-portrait img {
  position: relative;
  z-index: 1;
  width: 100%;
  border-radius: var(--radius);
  filter: grayscale(1) contrast(1.05);
  box-shadow: var(--shadow-md);
}
.hero-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  translate: 14px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

@media (max-width: 760px) {
  .hero-inner { grid-template-columns: 1fr; justify-items: start; }
  .hero-portrait { order: -1; width: clamp(140px, 42vw, 190px); }
}

.button-row { display: flex; flex-wrap: wrap; gap: 0.7rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background-color 0.18s, border-color 0.18s, color 0.18s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn svg { width: 1rem; height: 1rem; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }

.btn-ghost { border-color: var(--border); color: var(--text); background: var(--bg-elevated); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* =========================================================
   About
   ========================================================= */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }

.prose p + p { margin-top: 1rem; }
.prose { color: var(--text-muted); max-width: var(--prose); }

.subhead {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
.stack > * + * { margin-top: 2.25rem; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.5rem; border-left: 1px solid var(--border); }
.timeline li { position: relative; padding-bottom: 1.5rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1.5rem - 4.5px);
  top: 0.45rem;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
}
.timeline li.is-current::before { background: var(--accent); border-color: var(--accent); }
.timeline .when {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.timeline .what { font-weight: 600; font-size: 0.97rem; margin-top: 0.15rem; }
.timeline .where { color: var(--text-muted); font-size: 0.9rem; }

/* Tag clouds */
.tags { display: flex; flex-wrap: wrap; gap: 0.45rem; list-style: none; margin: 0; padding: 0; }
.tags li {
  font-size: 0.83rem;
  line-height: 1.4;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
}
.tags.is-quiet li { background: transparent; border-color: transparent; padding-inline: 0; }
.tags.is-quiet li:not(:last-child)::after { content: " ·"; color: var(--text-faint); }

/* =========================================================
   Research
   ========================================================= */
.quote {
  margin: 0 0 clamp(2rem, 5vw, 3rem);
  padding-left: 1.4rem;
  border-left: 2px solid var(--accent);
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
  max-width: 54ch;
}
.quote footer {
  margin-top: 0.7rem;
  font-size: 0.85rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}
@media (max-width: 700px) {
  .card-grid { grid-template-columns: 1fr; }
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

.card-media {
  aspect-ratio: 16 / 10;
  background: var(--bg-sunken);
  overflow: hidden;
}
.card-media img, .card-media video {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: scale 0.5s var(--ease);
}
.card:hover .card-media img { scale: 1.04; }

.card-body { padding: 1.15rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: 0.55rem; flex: 1; }
.card-body h3 { font-size: 1.05rem; }
.card-body h3 a { color: var(--text); text-decoration: none; }
.card-body h3 a:hover { color: var(--accent); }
.card-body p { font-size: 0.9rem; color: var(--text-muted); }

.card-links { list-style: none; margin: auto 0 0; padding: 0; display: grid; gap: 0.4rem; }
.card-links a {
  display: inline-flex;
  gap: 0.45rem;
  font-size: 0.86rem;
  line-height: 1.45;
  text-decoration: none;
  color: var(--text-muted);
}
.card-links a::before { content: "↗"; color: var(--accent); flex: none; }
.card-links a:hover { color: var(--accent); }
.card-links li.is-plain { font-size: 0.86rem; color: var(--text-muted); padding-left: 1.05rem; text-indent: -1.05rem; }
.card-links li.is-plain::before { content: "·"; color: var(--accent); padding-right: 0.6rem; }

/* =========================================================
   Publications
   ========================================================= */
.pub-group + .pub-group { margin-top: clamp(2.25rem, 5vw, 3rem); }
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub .me { color: var(--text); font-weight: 650; }
.pub {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--border);
}
.pub:first-child { border-top: none; padding-top: 0; }
.pub .year {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  padding-top: 0.2rem;
}
.pub h3 { font-size: 1.02rem; margin-bottom: 0.35rem; }
.pub h3 a { color: var(--text); text-decoration: none; }
.pub h3 a:hover { color: var(--accent); text-decoration: underline; }
.pub .meta { font-size: 0.9rem; color: var(--text-muted); }
.pub .doi {
  display: inline-block;
  margin-top: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  text-decoration: none;
  word-break: break-all;
}
.pub .doi:hover { color: var(--accent); }

@media (max-width: 560px) {
  .pub { grid-template-columns: 1fr; gap: 0.35rem; }
}

/* =========================================================
   Contact
   ========================================================= */
.contact { text-align: center; }
.contact .section-intro { margin-inline: auto; }
.mail {
  display: inline-block;
  font-size: clamp(1.4rem, 5vw, 2.35rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s var(--ease), color 0.2s;
  overflow-wrap: anywhere;
}
.mail:hover { color: var(--accent); background-size: 100% 2px; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}
.site-footer .shell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* =========================================================
   Scroll reveal
   ========================================================= */
/* Scoped to .js so the content is never hidden when scripting is unavailable. */
.js [data-reveal] {
  opacity: 0;
  translate: 0 14px;
  transition: opacity 0.6s var(--ease), translate 0.6s var(--ease);
}
.js [data-reveal].is-visible { opacity: 1; translate: 0 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .js [data-reveal] { opacity: 1; translate: none; }
}

/* =========================================================
   Print
   ========================================================= */
@media print {
  .site-header, .hero-portrait, .card-media, .site-footer, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .section { border-top: 1px solid #ccc; padding-block: 1rem; }
  a { color: #000; text-decoration: underline; }
}
