/* Beril Özsaraç — "just the right amount of chaos"
   --chaos (0..1) is set by the slider and shared by every page. */
:root {
    --chaos: 0;
    --bg: #fff;
    --fg: #131313;
    --line: color-mix(in srgb, var(--fg) 22%, transparent);
    --pad: clamp(16px, 2vw, 36px);
    --font: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
    --ease: cubic-bezier(.2, .9, .2, 1);
}
@view-transition { navigation: auto; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--fg); font: 400 18px/1.5 var(--font); min-height: 100dvh; display: flex; flex-direction: column; overflow-x: clip; transition: background-color .5s, color .3s; }
main { flex: 1; }
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
h1, h2 { font-weight: 800; font-stretch: 75%; letter-spacing: -.012em; line-height: .88; overflow-wrap: break-word; text-wrap: balance; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 99; background: var(--fg); color: var(--bg); padding: 8px 16px; }
.skip-link:focus { top: 16px; }

/* Header */
.site-header { position: absolute; inset: 0 0 auto; z-index: 50; display: flex; justify-content: space-between; align-items: center; gap: 16px; height: 88px; padding: 0 var(--pad); pointer-events: none; }
.site-header a { pointer-events: auto; }
.site-logo img { width: 56px; height: 56px; transition: transform .4s var(--ease); }
.site-logo:hover img { transform: rotate(-9deg) scale(1.08); }
.site-nav { display: flex; align-items: center; gap: clamp(14px, 2vw, 32px); font-weight: 600; }
.site-nav a { padding: 8px 0; border-bottom: 3px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current] { border-color: currentColor; }
.langs { display: flex; gap: 12px; font-size: 14px; font-weight: 500; }

/* Home table */
.table { position: relative; height: 100svh; min-height: 520px; overflow: hidden; }
.table .dock { left: var(--pad); translate: none; }
.ringed .rule { opacity: 0; }
.ringed .piece-media { height: 100%; }
.ringed .piece-cap { position: absolute; inset: 100% 0 auto; height: 28px; padding: 5px 8px 0; font-size: 11px; opacity: 0; transition: opacity .2s; }
.ringed .piece.lift .piece-cap { opacity: 1; }
.ringed .intro { justify-content: center; align-items: center; text-align: center; }
.ringed .intro h1 { font-size: calc(var(--d) * .085); }
.ringed .intro p { font-size: max(11px, calc(var(--d) * .019)); max-width: 20em; }
.stage.pin { height: 260vh; }
.stage.pin .table { position: sticky; top: 0; }
.rule { position: absolute; background: var(--line); pointer-events: none; transition: background-color .4s, opacity .4s; }
.piece { position: absolute; top: 0; left: 0; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.piece a { display: block; height: 100%; cursor: grab; }
.piece.drag a { cursor: grabbing; }
.piece-media { display: block; height: calc(100% - 34px); overflow: hidden; background: #ccc; }
.piece-media > * { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.piece-cap { display: flex; justify-content: space-between; gap: 12px; height: 34px; padding: 8px calc(8px * min(1, var(--chaos) * 8)) 0; font-size: 16px; line-height: 1.3; white-space: nowrap; background: var(--bg); transition: background-color .5s; }
.piece-cap b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.piece-cap span { opacity: .75; overflow: hidden; text-overflow: ellipsis; }
.piece.lift { z-index: 30 !important; }
.intro { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; pointer-events: none; }
.intro h1 { font-size: clamp(40px, 5.9vw, 124px); }
.intro p { font-size: clamp(14px, 1.05vw, 20px); line-height: 1.35; max-width: 24em; }

/* Chaos control */
.dock { position: absolute; left: 50%; bottom: 20px; translate: -50% 0; z-index: 40; display: flex; align-items: center; gap: 14px; background: #131313; color: #fff; padding: 0 8px 0 22px; height: 60px; font-weight: 600; max-width: calc(100vw - 24px); }
.dock label { display: contents; }
.dock input { -webkit-appearance: none; appearance: none; width: clamp(96px, 20vw, 280px); height: 44px; background: none; cursor: ew-resize; }
.dock input::-webkit-slider-runnable-track { height: 3px; background: #fff; }
.dock input::-moz-range-track { height: 3px; background: #fff; }
.dock input::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -11.5px; background: #f5c22e; border: 0; border-radius: 0; rotate: calc(var(--chaos) * 135deg); }
.dock input::-moz-range-thumb { width: 26px; height: 26px; background: #f5c22e; border: 0; border-radius: 0; rotate: calc(var(--chaos) * 135deg); }
.dock button { height: 44px; padding: 0 18px; background: #fff; color: #131313; font-weight: 700; }
.dock button:hover { background: #f5c22e; }

/* Words that lose their footing */
.w { display: inline-block; rotate: calc(var(--r) * var(--chaos) * 1deg); translate: 0 calc(var(--y) * var(--chaos) * 1em); transition: rotate .25s, translate .25s; }

/* About */
.page-about { --bg: #aeb4f5; }
.about-hero { position: relative; min-height: 100svh; padding: 130px var(--pad) 120px; display: flex; align-items: center; }
.about-hero h1 { font-size: clamp(50px, 12.4vw, 300px); text-transform: uppercase; }
.about-body { background: #fff; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.about-body > * { padding: clamp(32px, 4vw, 80px) var(--pad); border-right: 1px solid var(--line); }
.about-body > :last-child { border-right: 0; }
.about-body h2 { grid-column: span 2; font-size: clamp(36px, 4.6vw, 100px); line-height: .98; }
.about-body p { font-size: clamp(18px, 1.3vw, 26px); }
.about-body p + p { margin-top: 1em; }

/* Project */
.project-head { padding: 120px var(--pad) clamp(28px, 4vw, 72px); display: grid; grid-template-columns: 3fr 1fr; gap: 32px var(--pad); align-items: end; }
.project-head h1 { font-size: clamp(52px, 11vw, 270px); grid-column: 1 / -1; }
.project-head .intro-text { font-size: clamp(20px, 1.9vw, 38px); line-height: 1.3; max-width: 30em; }
.project-head ul { list-style: none; font-weight: 600; }
.project-head li { border-top: 1px solid var(--line); padding: 7px 0; }
.project-hero > * { width: 100%; max-height: 92vh; object-fit: cover; }
.project-text { padding: clamp(56px, 8vw, 150px) var(--pad); display: grid; grid-template-columns: 1fr 3fr; gap: 24px var(--pad); }
.project-text h2 { font-size: 20px; letter-spacing: 0; line-height: 1.3; font-stretch: 100%; }
.project-text p { font-size: clamp(20px, 2.1vw, 42px); line-height: 1.32; max-width: 32em; }
.gallery { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(24px, 4vw, 80px) var(--pad); padding: 0 var(--pad) clamp(72px, 9vw, 180px); align-items: center; }
.gallery figure { grid-column: span 7; rotate: calc(var(--r) * var(--chaos) * .35deg); }
.gallery figure:nth-child(4n+2) { grid-column: span 5; }
.gallery figure:nth-child(4n+3) { grid-column: 2 / span 5; }
.gallery figure:nth-child(4n) { grid-column: span 6; }
.gallery figure:only-child { grid-column: 1 / -1; }
.gallery img, .gallery video { width: 100%; height: auto; }
figcaption { font-size: 16px; padding-top: 8px; }
.next { display: grid; grid-template-columns: 3fr 1fr; align-items: end; gap: 24px var(--pad); background: var(--nbg); color: var(--nfg); padding: clamp(40px, 5vw, 96px) var(--pad); overflow: hidden; }
.next small { display: block; font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.next strong { display: block; font-size: clamp(48px, 9vw, 220px); font-weight: 800; font-stretch: 75%; letter-spacing: -.012em; line-height: .9; overflow-wrap: anywhere; }
.next img, .next video { width: 100%; aspect-ratio: 4/3; object-fit: cover; transition: transform .5s var(--ease); }
.next:hover img, .next:hover video { transform: rotate(-7deg) scale(1.12); }

.simple-page { padding: 170px var(--pad) 90px; }
.simple-page h1 { font-size: clamp(64px, 14vw, 320px); }
.simple-page p { margin: 28px 0; font-size: 22px; }
.link { font-weight: 700; border-bottom: 3px solid; }

/* Contact: a postcard */
.site-footer { background: #f5c22e; color: #131313; padding: clamp(48px, 7vw, 130px) var(--pad) 28px; }
.site-footer > h2 { font-size: clamp(44px, 7.4vw, 180px); margin-bottom: clamp(32px, 4vw, 72px); }
.postcard { background: #fff; display: grid; grid-template-columns: 1.15fr 1fr; max-width: 1240px; margin: 0 auto; padding: clamp(20px, 3vw, 48px); rotate: calc(var(--chaos) * -2.5deg); transition: rotate .4s var(--ease); }
.postcard:focus-within { rotate: 0deg; }
.pc-left { display: flex; flex-direction: column; gap: 8px; padding-right: clamp(20px, 3vw, 48px); border-right: 1px solid #131313; }
.pc-right { padding-left: clamp(20px, 3vw, 48px); display: grid; gap: 16px; align-content: space-between; }
.stamp { justify-self: end; width: 116px; height: 116px; padding: 12px; border: 2px dashed #131313; rotate: calc(var(--chaos) * 9deg); }
.form-group { display: grid; }
.form-group label, .pc-left label { font-size: 15px; font-weight: 600; }
.form-control { width: 100%; background: none; border: 0; border-bottom: 1px solid #131313; border-radius: 0; color: inherit; font: inherit; font-size: 18px; padding: 6px 0; min-height: 44px; }
.form-control:focus { outline: 0; box-shadow: 0 3px 0 #131313; }
textarea.form-control { flex: 1; min-height: 250px; resize: vertical; line-height: 40px; border: 0; background: repeating-linear-gradient(transparent 0 38px, #cfcfcf 38px 40px) local; padding: 0; }
textarea.form-control:focus { box-shadow: 0 0 0 2px #131313; }
.form-hp { display: none; }
.btn-submit { background: #131313; color: #fff; font-weight: 700; padding: 0 26px; min-height: 52px; justify-self: end; }
.btn-submit:hover { background: #8e1f2b; }
.btn-submit:disabled { opacity: .6; }
.form-status { display: none; grid-column: 1 / -1; padding: 12px 16px; margin-bottom: 20px; font-weight: 600; }
.form-status.success { display: block; background: #cfeedd; color: #0b4a2c; }
.form-status.error { display: block; background: #fbd9d9; color: #7d1010; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 36px; margin-top: clamp(40px, 5vw, 90px); font-weight: 500; font-size: 16px; }
.footer-bottom span { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer-bottom a:hover { text-decoration: underline; text-underline-offset: 4px; }

@media (max-width: 767px) {
    .site-header { height: 80px; }
    .site-logo img { width: 48px; height: 48px; }
    .site-nav { flex-wrap: wrap; justify-content: flex-end; gap: 0 14px; font-size: 15px; }
    .site-nav a { padding: 4px 0; }
    .langs { width: 100%; justify-content: flex-end; }
    .table .dock { left: 50%; translate: -50% 0; }
    .ringed .intro p { display: none; }
    .piece-cap { font-size: 14px; }
    .piece-cap span { display: none; }
    .intro h1 { font-size: 11.4vw; }
    .dock { gap: 8px; padding-left: 14px; font-size: 15px; }
    .dock input { width: 25vw; }
    .dock button { padding: 0 12px; }
    .about-body, .project-head, .project-text, .next, .postcard { grid-template-columns: minmax(0, 1fr); }
    .about-body h2 { grid-column: auto; }
    .about-body > * { border-right: 0; border-bottom: 1px solid var(--line); }
    .gallery { grid-template-columns: minmax(0, 1fr); }
    .gallery figure:nth-child(n) { grid-column: 1 / -1; }
    .pc-left { border-right: 0; border-bottom: 1px solid #131313; padding: 0 0 20px; }
    .pc-right { padding: 20px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
    @view-transition { navigation: none; }
}
