/* ==========================================================================
   Eray Mercan — design system 3 (applied to the PHP site; source: design_system_3/)
   Two typefaces, one accent, no boxes. Structure comes from hairline rules
   and spacing. The instrument flavour is kept to two touches: a faint
   graticule behind the home header and mono labels for dates and metadata.
   ========================================================================== */

:root {
  --bg:     #fbfaf7;
  --text:   #1b1a18;
  --body:   #3a3833;
  --muted:  #6b6862;
  --rule:   #e3e0d8;
  --accent: #1f4f86;
  --grid:   rgb(27 26 24 / .055);
  --ok:     #2f7a4b;
  --warn:   #a35f12;

  --serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  --mono:  "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --max: 64rem;
  --column: 44rem;
  --gutter: 1rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #141413;
    --text:   #ebe9e3;
    --body:   #cdcac2;
    --muted:  #9a978f;
    --rule:   #2c2b28;
    --accent: #8db4e2;
    --grid:   rgb(235 233 227 / .05);
    --ok:     #7cc79a;
    --warn:   #e0a35c;
  }
}

/* ---- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1.125rem/1.65 var(--serif);
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0; }
p, dl, dd { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
main:focus { outline: none; }

.container { max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.column > * { max-width: var(--column); }

.skip { position: absolute; left: -999px; top: 0; background: var(--text); color: var(--bg); padding: .5rem .75rem; }
.skip:focus { left: var(--gutter); }

/* The one mono element: small, uppercase, readable grey. */
.label {
  font: 400 .75rem/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}

/* ---- Header / footer ------------------------------------------------------ */
.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: .5rem 1.5rem; padding-top: 1.75rem; padding-bottom: 1.25rem;
}
.site-name { font-weight: 600; color: var(--text); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: 1rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--text); }
.nav a.is-active { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: .35em; }
.nav .lang {
  font: 400 .8125rem/1.9 var(--mono); color: var(--muted); cursor: pointer;
  background: none; border: 0; border-left: 1px solid var(--rule); padding: 0 0 0 1.25rem;
}
.nav .lang:hover { color: var(--text); }

.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem;
  position: relative; padding-top: 1.5rem; padding-bottom: 2.5rem; margin-top: 4rem;
  font: 400 .75rem/1.5 var(--mono); color: var(--muted);
}
.site-footer::before { content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); border-top: 1px solid var(--rule); }
.site-footer a { color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }

/* ---- Home ------------------------------------------------------------------ */
.graticule { position: relative; isolation: isolate; border-top: 1px solid var(--rule); }
.graticule::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 2rem 2rem;
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
          mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.hero { padding: 4rem 0 3rem; }
.hero-name { font-size: clamp(2.5rem, 6vw, 3.5rem); letter-spacing: -.02em; line-height: 1.05; }
.hero-statement { max-width: 38rem; margin-top: 1rem; font-size: 1.3125rem; line-height: 1.5; color: var(--body); }
.hero-affil { margin-top: 1.25rem; }

.home-body { display: grid; gap: 3rem; }
.home-body.with-photo { grid-template-columns: minmax(0, 1fr) 12.5rem; }
.home-body.with-photo .contact-block { grid-column: 1 / -1; }
.prose { max-width: 40rem; }
.prose p + p { margin-top: 1em; }
.portrait { width: 100%; height: auto; border-radius: 4px; }

.contact-block { max-width: 40rem; }
.contact-block h2 { padding-bottom: .6rem; border-bottom: 1px solid var(--rule); }
.contact > div {
  display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; align-items: baseline;
  padding: .7rem 0; border-bottom: 1px solid var(--rule);
}
.contact dt { font: 400 .75rem/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.contact dd { overflow-wrap: anywhere; }

/* ---- Inner page head ----------------------------------------------------- */
.page-head { padding-top: 3rem; padding-bottom: 2rem; }
.page-title { font-size: 2.25rem; letter-spacing: -.015em; margin-top: .5rem; }
.lede { max-width: 38rem; margin-top: .5rem; color: var(--muted); }
.pdfs { margin-top: 1rem; }

/* ---- Lists (publications, projects, CV entries) ---------------------------- */
.list > li { padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.list > li:last-child { border-bottom: 1px solid var(--rule); }
.item-title { font-size: 1.1875rem; line-height: 1.35; }
.item-title a { color: var(--text); text-decoration: none; }
.item-title a:hover { color: var(--accent); }
.list--projects .item-title { font-size: 1.375rem; margin-top: .3rem; }
.sub { color: var(--muted); font-size: 1.0625rem; }
.me { color: var(--text); font-weight: 600; }
.desc { margin-top: .4rem; color: var(--body); font-size: 1.0625rem; }
.org { color: var(--muted); font-size: 1.0625rem; }
.award { margin-top: .5rem; color: var(--warn); font-size: 1rem; }

.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; margin-top: .6rem;
  font: 400 .8125rem/1.6 var(--mono);
}
.status { color: var(--accent); text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; }

.dot { display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; margin-right: .4rem; vertical-align: middle; position: relative; top: -.1em; background: var(--muted); }
.dot--active { background: var(--ok); }
.dot--progress { background: var(--warn); }

section + section { margin-top: 2.5rem; }
.year { margin-bottom: .25rem; color: var(--accent); }

details.bib { display: contents; }
details.bib summary { cursor: pointer; color: var(--accent); list-style: none; }
details.bib summary::-webkit-details-marker { display: none; }
details.bib pre {
  flex-basis: 100%; margin: .4rem 0 0; padding: .8rem 0 .8rem 1rem; overflow-x: auto;
  border-left: 2px solid var(--rule);
  font: .75rem/1.6 var(--mono); color: var(--body);
}

/* ---- CV ------------------------------------------------------------------- */
.cv-grid { display: grid; gap: 0 3.5rem; align-items: start; }
@media (min-width: 58rem) { .cv-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr); } }
.cv-section { margin-bottom: 2.5rem; }
.section-title { font-size: 1.3125rem; padding-bottom: .7rem; border-bottom: 2px solid var(--text); }
.cv-section .list > li:first-child { border-top: 0; }
.row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .1rem 1rem; }
.row .label { white-space: nowrap; }
.facts > div { padding: .8rem 0; border-bottom: 1px solid var(--rule); }
.facts dt { margin-bottom: .15rem; }
.facts dd { color: var(--body); }

/* ---- Document viewer (opened by site.js) ----------------------------------- */
.viewer {
  width: min(64rem, calc(100vw - 2rem)); height: calc(100vh - 3rem); max-width: none; max-height: none;
  padding: 0; border: 1px solid var(--rule); border-radius: 6px;
  background: var(--bg); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / .25);
}
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgb(20 20 18 / .55); }
.viewer-bar { display: flex; align-items: center; gap: 1rem; padding: .5rem .5rem .5rem 1rem; border-bottom: 1px solid var(--rule); }
.viewer-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-open, .viewer-dl { font: .8125rem var(--mono); text-decoration: none; white-space: nowrap; }
.viewer-close { width: 2.25rem; height: 2.25rem; border: 0; border-radius: 4px; cursor: pointer; background: none; color: var(--muted); font-size: 1.5rem; line-height: 1; }
.viewer-close:hover { color: var(--text); background: var(--rule); }
.viewer-frame { flex: 1; width: 100%; border: 0; }
.viewer-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
html.viewer-lock { overflow: hidden; }

/* ---- Loading / error / toast (index.php shell) ----------------------------- */
.loading { padding-top: 4rem; padding-bottom: 4rem; }
.load-error { padding-top: 3rem; }
.load-error p + p { margin-top: .5rem; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 20;
  max-width: calc(100vw - 2rem); padding: .6rem 1rem; border-radius: 4px;
  background: var(--text); color: var(--bg); font: .8125rem/1.4 var(--mono);
}
.empty { padding: 1.4rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); color: var(--muted); }

/* ---- Small screens ---------------------------------------------------------- */
@media (max-width: 600px) {
  body { font-size: 1.0625rem; }
  .hero { padding: 2.75rem 0 2.25rem; }
  .hero-statement { font-size: 1.1875rem; }
  .home-body.with-photo { grid-template-columns: 1fr; }
  .portrait { max-width: 10rem; }
  .contact > div { grid-template-columns: 1fr; gap: 0; }
  .page-title { font-size: 1.875rem; }
}


@media print {
  .nav, .site-footer, .skip, .graticule::before { display: none; }
  body { background: #fff; color: #000; }
  a { color: inherit; text-decoration: none; }
}
