/* ==========================================================================
   Alpay Yildiray - Personal site
   Editorial style matching the AltaCV CV: dark red, gold, warm cream.
   Light + dark themes via .dark class on <html> (set before first paint).
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* palette */
  --red-900: #450808;
  --red-700: #8f0d0d;
  --red-hover: #5f0909;
  --gold: #e7d192;
  --gold-dim: rgba(231, 209, 146, 0.35);

  /* semantic (light) */
  --bg: #faf8f3;
  --bg-alt: #ffffff;
  --card: #ffffff;
  --border: #e8e2d4;
  --border-strong: #d8d0bd;
  --heading: #450808;
  --ink: #2e2e2e;
  --body: #5b544b;
  --muted: #8a8276;
  --dot-off: #e2dbc9;
  --hero-top: #fffdf6;
  --header-bg: rgba(69, 8, 8, 0.96);

  --shadow-sm: 0 1px 2px rgba(69, 8, 8, 0.06);
  --shadow-md: 0 2px 6px rgba(69, 8, 8, 0.07), 0 10px 28px rgba(69, 8, 8, 0.08);
  --shadow-lg: 0 4px 10px rgba(69, 8, 8, 0.10), 0 18px 44px rgba(69, 8, 8, 0.14);

  --serif: "Roboto Slab", Georgia, "Times New Roman", serif;
  --sans: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --wrap: 1080px;
  --radius: 12px;
}

.dark {
  /* semantic (dark) - warm near-black, keeps the red/gold identity */
  --bg: #171210;
  --bg-alt: #1d1713;
  --card: #221b16;
  --border: #372e26;
  --border-strong: #4a3f34;
  --heading: #e7cf9e;
  --ink: #ece5da;
  --body: #b6aca0;
  --muted: #8c8175;
  --dot-off: #3a322a;
  --hero-top: #1e1813;
  --header-bg: rgba(26, 9, 8, 0.96);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.45), 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.5), 0 20px 48px rgba(0, 0, 0, 0.6);

  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

a { color: var(--red-700); }
.dark a { color: var(--gold); }

::selection { background: var(--gold); color: var(--red-900); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Skip link ---------- */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--red-900);
  color: #fff;
  padding: 12px 18px;
  z-index: 100;
}
.skip:focus { left: 12px; top: 12px; border-radius: 6px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
  padding-block: 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* Monogram: the navbar sits directly above the <h1> carrying the full name,
   so a wordmark there would just repeat it. Initials read as a logo instead. */
.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--gold);
  border-radius: 10px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.brand:hover,
.brand:focus-visible {
  background: var(--gold);
  color: var(--red-900);
  transform: translateY(-1px);
}

.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }

.site-nav a {
  color: var(--gold);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 10px;
  border-radius: 6px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(231, 209, 146, 0.15);
  color: #fff;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: rgba(231, 209, 146, 0.15);
  border-color: var(--gold);
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.dark .theme-toggle .icon-sun { display: block; }
.dark .theme-toggle .icon-moon { display: none; }

/* ---------- Scroll progress ---------- */
/* Sits at the header's bottom edge: dim gold track, solid gold fill. */
.progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--gold-dim);
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.08s linear;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 76px 0 68px;
  background:
    radial-gradient(900px 380px at 88% -12%, rgba(231, 209, 146, 0.20), transparent 62%),
    radial-gradient(700px 320px at 6% 112%, rgba(143, 13, 13, 0.07), transparent 60%),
    linear-gradient(180deg, var(--hero-top) 0%, var(--bg) 100%);
}

/* Subtle dot grid fading out towards the fold. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(69, 8, 8, 0.09) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 72%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 72%);
  pointer-events: none;
}

.dark .hero::before {
  background-image: radial-gradient(rgba(231, 209, 146, 0.10) 1px, transparent 1.4px);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  gap: 48px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  margin: 0 0 16px;
  letter-spacing: -0.015em;
}

/* Short gold flourish under the name. */
.hero h1::after {
  content: "";
  display: block;
  width: 88px;
  height: 4px;
  margin-top: 16px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), rgba(231, 209, 146, 0));
}

.tagline {
  color: var(--red-700);
  font-size: 1.04rem;
  font-weight: 700;
  margin: 0 0 26px;
  max-width: 62ch;
}

.dark .tagline { color: var(--gold); }

/* Photo with double ring: solid gold close, ghost ring further out. */
.hero-photo-wrap {
  position: relative;
  width: 190px;
  height: 190px;
  margin: 0 auto;
}

.hero-photo-wrap::before {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  opacity: 0.55;
}

.hero-photo-wrap::after {
  content: "";
  position: absolute;
  inset: -21px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  opacity: 0.22;
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--gold);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero entrance (skipped entirely when motion is reduced). */
@media (prefers-reduced-motion: no-preference) {
  .js .hero-inner > div { animation: rise 0.7s 0.05s ease both; }
  .js .hero-photo-wrap { animation: rise 0.7s 0.18s ease both; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease,
              border-color 0.18s ease, box-shadow 0.18s ease;
}

.btn svg { width: 15px; height: 15px; }

/* .btn.btn-* (0,2,0) so the colour survives the `.dark a` gold rule (0,1,1). */
.btn.btn-primary {
  background: var(--red-700);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn.btn-primary:hover,
.btn.btn-primary:focus-visible {
  background: var(--red-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn.btn-ghost {
  border-color: var(--gold);
  color: var(--heading);
  background: var(--card);
}
.btn.btn-ghost:hover,
.btn.btn-ghost:focus-visible {
  background: var(--gold);
  color: var(--red-900);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ---------- Sections ---------- */
section { padding: 76px 0; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 36px;
}

.section-num {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--heading);
  white-space: nowrap;
}

.section-num::after {
  content: "—";
  color: var(--gold);
  margin-left: 12px;
  font-weight: 400;
}

.section-head h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  margin: 0;
  position: relative;
  padding-bottom: 12px;
}

.section-head h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 64px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
}

.alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
}

/* ---------- Timeline (Experience / Education) ---------- */
.timeline {
  position: relative;
  padding-left: 34px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
}

.timeline .card::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 30px;
  width: 11px;
  height: 11px;
  background: var(--red-700);
  border: 2px solid var(--bg);
  border-radius: 2px;
  transform: rotate(45deg);
}

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red-700);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card + .card { margin-top: 20px; }

.card:hover,
.card:focus-within {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  border-left-color: var(--red-700);
}

.card h3 { font-size: 1.13rem; margin: 0 0 3px; }

.card .role {
  font-weight: 700;
  color: var(--red-700);
  font-size: 0.93rem;
  margin: 0 0 12px;
}

.dark .card .role { color: var(--gold); }

/* Thesis line under a degree. Separated by a hairline rule; the grade is
   emphasised since it is the differentiating detail. */
.thesis {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--body);
}

.thesis-label {
  font-weight: 700;
  color: var(--heading);
  font-style: normal;
}

.thesis-label::after { content: ":"; }

.thesis-grade {
  font-weight: 700;
  color: var(--red-700);
  white-space: nowrap;
}

.dark .thesis-grade { color: var(--gold); }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 0.83rem;
  color: var(--muted);
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.meta li { display: flex; align-items: center; gap: 6px; }

.meta .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}

/* ---------- Lists ---------- */
.ticks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.ticks li { position: relative; padding-left: 27px; }

.ticks li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.6em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--red-700);
  transform: rotate(45deg);
}

.ticks.ticks-nested { margin-top: 10px; gap: 6px; padding-left: 14px; }

.ticks.ticks-nested li { font-size: 0.92em; color: var(--body); }

.ticks.ticks-nested li::before {
  background: var(--gold);
  left: 10px;
  width: 6px;
  height: 6px;
  top: 0.64em;
}

/* ---------- Skill tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 10px; }

.tag {
  display: inline-block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.87rem;
  font-weight: 700;
  color: var(--heading);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.18s ease, color 0.18s ease,
              border-color 0.18s ease, transform 0.18s ease;
}

.tag:hover {
  background: var(--red-700);
  color: #fff;
  border-color: var(--red-700);
  transform: translateY(-2px);
}

/* ---------- Two column ---------- */
.cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px;
}

/* ---------- Languages ---------- */
.lang-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}

.lang-row + .lang-row { border-top: 1px solid var(--border); }

.lang-name { font-weight: 700; color: var(--ink); font-size: 0.92rem; }

.dots { display: flex; gap: 6px; }

.dots i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--dot-off);
  display: block;
}

.dots i.on { background: var(--red-700); }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.contact-card:hover,
.contact-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
}

.contact-card svg { flex: none; transition: transform 0.18s ease; }
.contact-card:hover svg { transform: scale(1.1); }

.contact-card .k {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.contact-card .v {
  font-weight: 700;
  color: var(--heading);
  word-break: break-word;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--red-900);
  color: var(--gold);
  border-top: 3px solid var(--gold);
  padding: 28px 0;
  font-size: 0.87rem;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.to-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  text-decoration: none;
  font-weight: 700;
}

.to-top svg { width: 14px; height: 14px; }
.to-top:hover { text-decoration: underline; }

/* ---------- Scroll reveal ----------
   Scoped to .js so that without JavaScript the content is simply
   visible instead of permanently stuck at opacity:0. */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .hero { padding: 56px 0 52px; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; gap: 36px; }
  .hero-photo-wrap { width: 160px; height: 160px; }
  .hero h1::after { margin-inline: auto; }
  .tagline { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .cols { grid-template-columns: 1fr; }
  .lang-row { grid-template-columns: 92px 1fr; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 7px 7px; font-size: 0.76rem; }
  section { padding: 60px 0; }
  .timeline { padding-left: 28px; }
  .timeline .card::before { left: -25px; width: 9px; height: 9px; top: 28px; }
  .card { padding: 20px 20px; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .hero-actions, .site-footer, .progress { display: none; }
  body { background: #fff; color: #333; }
  .hero { background: none; }
  .hero::before { display: none; }
  .hero h1, h2, h3, .card .role, .tag, .contact-card .v { color: #450808; }
  .card, .contact-card, .tag { background: #fff; border-color: #ccc; box-shadow: none; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .card { break-inside: avoid; }
  .timeline::before { background: #e7d192; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}