/* ============================================================
   Mehmet Demir — Portfolio
   ============================================================ */

/* --- Tokens -------------------------------------------------- */

:root {
  --bg:            #fafbfc;
  --surface:       #ffffff;
  --text:          #111214;
  --text-soft:     #646464;
  --muted:         #6d6d73;
  --line:          #e4e5e8;
  --line-soft:     #ededf0;
  --hover:         #f0f1f3;
  --active:        #e4e6ea;
  --accent:        #17181a;
  --accent-text:   #fafaf9;
  --ring:          #a3a3ab;
  --shadow:        0 1px 2px rgba(23, 24, 26, .04), 0 8px 24px rgba(23, 24, 26, .05);

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

  --measure: 640px;
  --gutter: 21px;
  --radius: 8px;

  /* Tunable. These are the values that get argued about; naming them means they
     can be driven live by assets/js/dials.js (append ?dials to the URL). */
  --portrait-size:   52px;
  --portrait-radius: 12px;
  --dot-size:         9px;
  --panel-ms:       260ms;
  --panel-pad:       20px;
  --press-scale:      .995;
  --gap-section:     56px;
  --gap-major:       72px;
  --gap-minor:       44px;

  /* Entrance reveal. Tunable from the dial panel. */
  --stagger-dur:      300ms;
  --stagger-distance:  12px;
  --stagger-stagger:   20ms;
  --stagger-blur:       0px;
  /* Caps the cascade. Only the first six steps are above the fold, so the rest
     needs no rhythm nobody sees, only to be ready before anyone scrolls to it. */
  --stagger-max:      240ms;
  --stagger-ease: cubic-bezier(0.33, 1, 0.68, 1);

  /* Entrances arrive fast and settle; exits leave gently and end fast. */
  --ease:    cubic-bezier(0.4, 0, 0.6, 1);
  --ease-in: cubic-bezier(0.25, 0.1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0c0c0d;
    --surface:     #141416;
    --text:        #ededec;
    --text-soft:   #a8a8ae;
    --muted:       #8d8d95;
    --line:        #26262a;
    --line-soft:   #1e1e21;
    --hover:       #1a1c20;
    --active:      #24272c;
    --accent:      #ededec;
    --accent-text: #0c0c0d;
    --ring:        #55555c;
    --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

:root[data-theme="dark"] {
  --bg:          #0c0c0d;
  --surface:     #141416;
  --text:        #ededec;
  --text-soft:   #a8a8ae;
  --muted:       #8d8d95;
  --line:        #26262a;
  --line-soft:   #1e1e21;
  --hover:       #1a1c20;
  --active:      #24272c;
  --accent:      #ededec;
  --accent-text: #0c0c0d;
  --ring:        #55555c;
  --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}

/* --- Reset --------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "cv05" 1, "cv11" 1;
  letter-spacing: -.02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .32s var(--ease), color .32s var(--ease);
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; margin: 0; }

/* Anything that can be clicked shows the hand, regardless of UA defaults. */
a, button, [role="button"], label, summary { cursor: pointer; }

a {
  color: var(--text);
  text-decoration: none;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

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

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

/* --- Layout -------------------------------------------------- */

.shell {
  width: 100%;
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin-inline: auto;
  padding: 84px var(--gutter) 0;
}

/* Rhythm carries weight: the portfolio gets more air than the appendix. */
.section { margin-top: var(--gap-section); }
.section--major { margin-top: var(--gap-major); }
.section--minor { margin-top: var(--gap-minor); }

.section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 5px;
}

.section-icon {
  flex: none;
  opacity: .7;
}

/* --- Entrance reveal ------------------------------------------ */

/* Two guards on the hidden state, both deliberate:

   .js-reveal is set by an inline script in <head>. Without JavaScript the class
   never lands, nothing is ever hidden, and the page renders as normal text. A
   bare `opacity: 0` here would leave the whole hero permanently invisible the
   moment a script fails to run.

   prefers-reduced-motion means the content is never hidden in the first place,
   rather than hidden and then snapped visible. Nothing to flash. */
@media (prefers-reduced-motion: no-preference) {
  .js-reveal .t-stagger-line {
    opacity: 0;
    transform: translateY(var(--stagger-distance));
    filter: blur(var(--stagger-blur));
    /* --i is the position in the sequence, set per element in the markup, so
       adding a line does not mean writing another CSS rule. */
    transition:
      opacity   var(--stagger-dur) var(--stagger-ease),
      transform var(--stagger-dur) var(--stagger-ease),
      filter    var(--stagger-dur) var(--stagger-ease);
    transition-delay: min(calc(var(--stagger-stagger) * var(--i, 0)), var(--stagger-max));
    will-change: transform, opacity, filter;
  }

  .js-reveal .t-stagger.is-shown .t-stagger-line {
    opacity: 1;
    transform: none;
    filter: none;
  }

  /* Dropped once the reveal is over: a permanent will-change keeps every line on
     its own compositor layer for the life of the page, for no further benefit. */
  .js-reveal .t-stagger.is-done .t-stagger-line {
    will-change: auto;
    transition: none;
  }
}

/* --- Hero ---------------------------------------------------- */

.hero-top {
  display: flex;
  /* Centred, not top-aligned: the dot then sits on the portrait's optical middle
     instead of floating beside its top edge. */
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  /* The gap below the portrait lives here, not on the image: a bottom margin on
     a flex item shifts what align-items centres. */
  margin-bottom: 18px;
}

.hero-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 28px;
}
.hero-nav .btn {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}


.portrait {
  width: var(--portrait-size);
  height: var(--portrait-size);
  border-radius: var(--portrait-radius);
  object-fit: cover;
  background: var(--hover);
}

.hero-name {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -.005em;
  line-height: 1.4;
  margin: 0;
}

/* Per-character shimmer wave. */
.hero-name .char {
  display: inline-block;
  color: var(--muted);
  animation: char-shimmer 3s ease-in-out infinite;
  animation-delay: calc(var(--char-i) * 0.08s);
}

@keyframes char-shimmer {
  0%, 100% { color: var(--muted); }
  15%, 35% { color: var(--text); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-name .char {
    color: var(--text);
    animation: none;
  }
}

.hero-role {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

/* Role cycling: when JS activates, items stack and crossfade. */
.hero-role.has-role-cycle {
  position: relative;
  min-height: 1.4em;
}
.hero-role.has-role-cycle .role-cycle {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
  pointer-events: none;
  white-space: nowrap;
}
.hero-role.has-role-cycle .role-cycle.is-active {
  position: relative;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.hero-role.has-role-cycle .role-cycle + .role-cycle::before {
  content: none;
}

@media (prefers-reduced-motion: reduce) {
  .hero-role.has-role-cycle .role-cycle {
    transition: none;
  }
}

/* A row of attributes separated by middots. Shared by the hero role line and
   Expertise, so the separator is defined once. Whole items wrap; the separator
   travels with the item it precedes rather than being stranded at a line end. */
.inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.inline-list > * + *::before {
  content: "·";
  margin: 0 6px;
  color: var(--muted);
}

.prose {
  margin-top: 28px;
}

.prose p {
  margin: 0 0 20px;
  color: var(--text-soft);
  max-width: 60ch;
  /* Reduces short last lines. Single letters are bound to the following word in
     the markup with a non-breaking space, because pretty does not catch those. */
  text-wrap: pretty;
}

.prose p:last-child { margin-bottom: 0; }

.prose strong {
  font-weight: 500;
  color: var(--text);
}

/* --- Buttons ------------------------------------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -.005em;
  background: var(--hover);
  border: 0;
  color: var(--text);
  cursor: pointer;
  transition: background-color .18s var(--ease), transform .18s var(--ease);
}

.btn:hover {
  background: var(--active);
}

.btn--solid {
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
}
.btn--solid:hover {
  background: var(--accent);
  color: var(--accent-text);
  opacity: .78;
}

.btn--ghost {
  color: var(--text-soft);
}
.btn--ghost:hover {
  background: var(--active);
  color: var(--text);
}

.btn:active {
  transform: scale(.97);
  transition-duration: .1s;
}

.btn .arrow {
  font-size: 11.5px;
  opacity: .55;
  transition: transform .18s var(--ease);
}
.btn:hover .arrow { transform: translate(1px, -1px); }

/* --- Rows (shared) ------------------------------------------- */

/* Two row treatments, on purpose:
   - Project rows are interactive, so the hover surface is the affordance.
     No rules — the fill does the separating.
   - Static data lists (Experience, Teaching) get hairlines instead, because
     nothing there responds to the cursor. */
.rows { display: flex; flex-direction: column; gap: 4px; }
.rows--ruled { border-top: 0; }

.row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 14px;
  width: calc(100% + 32px);
  padding: 10px 16px;
  margin-inline: -16px;
  border-radius: 8px;
  text-align: left;
  transition: background-color .16s var(--ease), transform .12s var(--ease);
}

/* Rows without an icon or a trailing control: label left, meta right.
   No hover fill here, so no bleed either — the row sits exactly on the text
   column, which keeps the rules flush with the section label above them. */
.row--simple {
  grid-template-columns: 1fr auto;
  /* Baseline, not centre: the year should sit on the company name, not float
     between the two lines of the cell. */
  align-items: baseline;
  width: 100%;
  margin-inline: 0;
  padding: 12px 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line-soft);
}

.rows--ruled > .row:last-child { border-bottom: 0; }

.row-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -.008em;
}

.row-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .01em;
  white-space: nowrap;
}

/* --- Work ---------------------------------------------------- */

.work-toggle {
  grid-template-columns: auto 1fr auto;
  cursor: pointer;
}
.work-toggle:hover { background: var(--hover); }

/* Press feedback. On touch there is no hover at all, so without this a tap sits
   silent for the whole length of the panel transition. The scale is deliberately
   tiny: at 660px wide, .995 moves each edge under 2px, felt rather than seen. */
.work-toggle:active {
  background: var(--active);
  transform: scale(var(--press-scale));
}

/* With no rules on the list, the open project holds its fill so the expanded
   panel stays visually attached to the row it belongs to. */
.work-item.is-open .work-toggle { background: var(--hover); }

/* Focus effect: hovering one project fades the others. Only on devices
   that support real hover — on touch, sticky :hover would leave rows
   faded after a tap. */
@media (hover: hover) {
  .rows:hover .work-item { opacity: .2; transition: opacity .25s var(--ease); }
  .rows:hover .work-item:hover { opacity: 1; }
}


.work-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: contain;
  flex: none;
}

.work-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

/* One line of substance in the collapsed state, so the row list says
   something before anyone clicks. The client leads it — sitting it out on the
   right made a third element compete for the row's trailing edge. */
.work-sub {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
}

.work-for { color: var(--text-soft); }
.work-for::after {
  content: "·";
  margin: 0 5px;
  color: var(--muted);
}

.plus {
  position: relative;
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--text-soft);
  transition: transform .3s var(--ease), color .18s var(--ease);
}
.plus::before,
.plus::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto 0;
  height: 1px;
  background: currentColor;
}
.plus::after { transform: rotate(90deg); }

.work-toggle:hover .plus { color: var(--text); }
.work-toggle[aria-expanded="true"] .plus { transform: rotate(135deg); color: var(--text); }

.panel {
  display: grid;
  grid-template-rows: 0fr;
  /* This rule is the closed state, so its curve is the one used when closing.
     The open rule below overrides it for the other direction. */
  transition: grid-template-rows var(--panel-ms) var(--ease-in);
}
.work-item.is-open .panel {
  grid-template-rows: 1fr;
  transition-timing-function: var(--ease);
}

.panel-clip { overflow: hidden; }

/* Symmetric 20px top and bottom. The open row keeps a filled background, so the
   first line needs room to clear it; 2px had the tightest gap on the page sitting
   at its most important edge. */
.panel-inner {
  padding: var(--panel-pad) 0 var(--panel-pad) 38px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .2s var(--ease) .04s, transform .2s var(--ease) .04s;
}
.work-item.is-open .panel-inner { opacity: 1; transform: none; }

.panel-inner p {
  margin: 0 0 16px;
  color: var(--text-soft);
  max-width: 58ch;
  text-wrap: pretty;
}

.shot {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

/* --- Expertise ----------------------------------------------- */

/* Plain text, not chips. Bordered rounded boxes read as pressable, and these
   sat 400px below a row of ghost buttons that actually are. Every bordered
   element on the page is now genuinely interactive. */
.tags { color: var(--text-soft); }
.tags > * + *::before { content: none; }

/* --- Logos --------------------------------------------------- */

.logo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
}

.logo-row li {
  color: var(--text-soft);
  opacity: .62;
  transition: color .2s var(--ease), opacity .2s var(--ease), transform .2s var(--ease);
}
.logo-row li:hover {
  color: var(--text);
  opacity: 1;
  transform: translateY(-1px);
}

.logo { height: 21px; width: auto; }

.logo-row--tools li { opacity: .85; }
.logo-row--tools img {
  height: 24px;
  width: 24px;
  border-radius: 5px;
  object-fit: contain;
  /* Hairline keeps very dark icons (Cursor) readable on the dark background. */
  box-shadow: 0 0 0 1px var(--line);
}

/* --- Floating bar -------------------------------------------- */

.floating-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
  border-radius: 14px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, .04),
    0 4px 12px rgba(0, 0, 0, .06),
    0 12px 28px rgba(0, 0, 0, .08);
  z-index: 100;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}

[data-theme="dark"] .floating-bar {
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-color: color-mix(in srgb, var(--line) 40%, transparent);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, .2),
    0 4px 12px rgba(0, 0, 0, .25),
    0 12px 28px rgba(0, 0, 0, .3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .floating-bar {
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    border-color: color-mix(in srgb, var(--line) 40%, transparent);
    box-shadow:
      0 1px 2px rgba(0, 0, 0, .2),
      0 4px 12px rgba(0, 0, 0, .25),
      0 12px 28px rgba(0, 0, 0, .3);
  }
}

.bar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--text-soft);
  text-decoration: none;
  position: relative;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.bar-link:hover {
  background: var(--hover);
  color: var(--text);
}

.bar-link::after {
  content: attr(aria-label);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s var(--ease), transform .15s var(--ease);
}
.bar-link:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .floating-bar { transition: none; }
}

/* --- Footer -------------------------------------------------- */

.footer {
  margin-top: 72px;
  padding: 22px 0 40px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13.5px;
  font-weight: 500;
}

/* This is the conversion point of the page — it does not get the
   quietest colour in the system. */
.footer-links a {
  color: var(--text-soft);
  padding: 4px 10px;
  border-radius: 8px;
  transition: color .16s var(--ease), background .16s var(--ease);
}
.footer-links a:active { opacity: .55; }
.footer-links a:hover {
  color: var(--text);
  background: var(--hover);
  border-radius: 8px;
  text-decoration: none;
}

.colophon {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .01em;
}

/* --- Theme toggle -------------------------------------------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-soft);
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.theme-toggle:hover {
  background: var(--hover);
  color: var(--text);
}

/* Sun visible in light mode, moon in dark mode. */
.toggle-icon-dark { display: none; }
.toggle-icon-light { display: block; }
[data-theme="dark"] .toggle-icon-dark { display: block; }
[data-theme="dark"] .toggle-icon-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toggle-icon-dark { display: block; }
  :root:not([data-theme="light"]) .toggle-icon-light { display: none; }
}

/* --- Utilities ----------------------------------------------- */

/* --- Tooltip ------------------------------------------------- */

.has-tooltip {
  position: relative;
  cursor: help;
  transition: color .18s var(--ease);
}

.has-tooltip:hover {
  color: var(--text);
}

.asterism {
  display: inline-block;
  transition: transform .5s var(--ease);
}
.has-tooltip:hover .asterism {
  transform: rotate(360deg);
}

.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: auto;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .04em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}

.has-tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Utilities ----------------------------------------------- */

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

/* --- Responsive ---------------------------------------------- */

@media (max-width: 560px) {
  .shell { padding-top: 48px; }
  .section { margin-top: 40px; }
  .section--major { margin-top: 56px; }
  .section--minor { margin-top: 32px; }
  .work-toggle { padding-top: 14px; padding-bottom: 14px; }
  .panel-inner { padding-left: 0; }
  .logo-row { gap: 18px; }
  .footer { flex-direction: column; align-items: flex-start; }
}

/* Wrapping a middot list strands a separator at the start of the next line, so
   a list that cannot hold one line stacks instead and drops its separators.
   The two lists carry different amounts of text and therefore break at
   different widths, measured rather than guessed: the role line holds to 414px,
   Expertise needs 600px. */
@media (max-width: 400px) {
  .hero-role { flex-direction: column; }
  .hero-role > * + *::before { content: none; }
}

@media (max-width: 599px) {
  .tags { flex-direction: column; }
  .tags > * + *::before { content: none; }
}

/* --- Motion preferences -------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* --- Print --------------------------------------------------- */

@media print {
  .theme-toggle, .plus { display: none; }
  .panel { grid-template-rows: 1fr !important; }
  .panel-inner { opacity: 1 !important; transform: none; }
  .shell { padding-top: 0; max-width: none; }
}
