/* ============================================================
   Bengi Kirici — personal site
   Minimal, warm, interactive 3D.
   ============================================================ */

:root {
  --bg: #faf7f2;
  --ink: #1c1a17;
  --ink-soft: #5c574f;
  --accent: #e05d38;       /* warm terracotta — a nod to Istanbul */
  --accent-soft: #f5ddd4;
  --line: #e4ddd2;
  --card: #ffffff;
  --radius: 20px;
  --font-sans: "Inter", -apple-system, sans-serif;
  --font-tech: "Space Grotesk", "Inter", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* dark mode — technical drawing feel: near-black, white lines, orange accent */
body.dark {
  --bg: #151310;
  --ink: #f0eadf;
  --ink-soft: #a49c8f;
  --line: #35312b;
  --card: #1e1b17;
  --accent-soft: #3a241c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* visually hidden, but readable by search engines and screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

::selection { background: var(--accent); color: #fff; }

/* subtle film grain for warmth */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ Header ============ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 64px);
  background: transparent;
  border-bottom: none;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  transition: transform 0.25s var(--ease);
}
.logo:hover { transform: scale(1.06); }

.logo-mark {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 7px;
}

.site-nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 32px); }

.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.25s;
}
.site-nav a:hover { color: var(--ink); }

.nav-cta {
  color: var(--ink) !important;
  border: 1px solid var(--ink);
  padding: 8px 18px;
  border-radius: 100px;
  transition: background 0.3s var(--ease), color 0.3s var(--ease) !important;
}
.nav-cta:hover { background: var(--ink); color: var(--bg) !important; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, transform 0.25s var(--ease);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(15deg); }
.theme-toggle .icon-sun { display: none; }
body.dark .theme-toggle .icon-sun { display: block; }
body.dark .theme-toggle .icon-moon { display: none; }

/* ============ 3D Hero ============ */
.hero {
  position: relative;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
}

#scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
#scene-canvas.ready { opacity: 1; }
#scene-canvas:active { cursor: grabbing; }

.hero-copy {
  position: absolute;
  top: clamp(84px, 14vh, 130px);
  left: clamp(20px, 5vw, 64px);
  z-index: 5;
  pointer-events: none;
  animation: heroIn 1.1s var(--ease) 0.2s both;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 22px 26px;
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: clamp(2.3rem, 5.2vw, 4.1rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.hero-role {
  display: block;
  font-family: var(--font-tech);
  font-weight: 500;
  font-size: clamp(0.85rem, 1.6vw, 1.15rem);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 14px;
}

.hero-tags {
  margin-top: 18px;
  font-family: var(--font-tech);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1.9;
}

.hero-hint {
  position: absolute;
  top: 50%;
  right: clamp(48px, 6vw, 88px);
  transform: translateY(-50%) rotate(90deg);
  transform-origin: right center;
  z-index: 5;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  pointer-events: none;
  animation: heroIn 1.1s var(--ease) 0.9s both;
  transition: opacity 0.8s;
}
.hero-hint.fade-out { opacity: 0; }

/* --- control panels --- */
.hero-ui {
  position: absolute;
  left: clamp(16px, 4vw, 56px);
  right: clamp(16px, 4vw, 56px);
  bottom: clamp(16px, 4vh, 36px);
  z-index: 6;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  animation: heroIn 1.1s var(--ease) 0.6s both;
}

.scene-ui,
.cam-ui {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: 0 12px 40px -18px rgba(28, 26, 23, 0.25);
}

.scene-ui {
  display: flex;
  gap: clamp(16px, 3vw, 36px);
  flex-wrap: wrap;
}

body.dark .scene-ui { display: none; }

body.dark .hero-ui {
  justify-content: flex-end;
}

body.dark .cam-ui {
  margin-left: auto;
}

.ui-label {
  display: block;
  font-family: var(--font-tech);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.swatches { display: flex; gap: 8px; }

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: var(--c);
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.swatch:hover { transform: scale(1.15); }
.swatch.active {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.cam-ui { padding: 14px 18px; }

.cam-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

.cam-btn {
  font-family: var(--font-tech);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  white-space: nowrap;
}
.cam-btn:hover { border-color: var(--ink); color: var(--ink); }
.cam-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* webgl fallback */
.no-webgl #scene-canvas { display: none; }
.no-webgl .hero-ui, .no-webgl .hero-hint { display: none; }

/* ============ Section dot navigation ============ */
.dot-nav {
  position: fixed;
  right: clamp(12px, 2vw, 24px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dot-nav .dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-soft);
  background: transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.dot-nav .dot:hover { border-color: var(--accent); transform: scale(1.35); }
.dot-nav .dot.active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.2);
}

/* label that slides out on hover */
.dot-nav .dot::after {
  content: attr(data-label);
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  font-family: var(--font-tech);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.dot-nav .dot:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }

/* ============ Sections (shared) ============ */
.section {
  padding: clamp(64px, 10vh, 110px) clamp(20px, 5vw, 64px);
  max-width: 1200px;
  margin: 0 auto;
}

/* full-viewport sections for header navigation targets */
.fullscreen {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.section-label {
  font-family: var(--font-tech);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.82rem;
  margin-bottom: 24px;
}

/* scroll-triggered reveal */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============ Projects ============ */
.project-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.p-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px 30px;
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease),
              border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.p-card:nth-child(2) { transition-delay: 0.08s; }
.p-card:nth-child(3) { transition-delay: 0.16s; }
.p-card:nth-child(4) { transition-delay: 0.24s; }
.p-card:nth-child(5) { transition-delay: 0.32s; }

.p-card:hover {
  border-color: var(--accent);
  box-shadow: 0 18px 44px -20px rgba(224, 93, 56, 0.35);
}
.p-card.visible:hover { transform: translateY(-5px); transition-delay: 0s; }

.p-card h2 {
  font-family: var(--font-tech);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.p-card .name-dot { color: var(--accent); }
.p-card p { color: var(--ink-soft); font-size: 0.92rem; }

.p-arrow {
  position: absolute;
  right: 22px;
  bottom: 20px;
  font-weight: 600;
  transition: transform 0.3s var(--ease);
}
.p-card:hover .p-arrow { transform: translateX(5px); }

/* featured reviz card — big, full width, above the rest */
.p-card.featured {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
  padding: clamp(32px, 5vw, 60px);
  margin-bottom: 12px;
}
.p-card.featured h2 {
  color: #fff;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  margin-bottom: 10px;
}
.p-card.featured p {
  color: #b8b2a8;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  max-width: none;
  padding-right: clamp(48px, 8vw, 80px);
}
.p-card.featured .p-arrow {
  right: clamp(24px, 4vw, 56px);
  bottom: clamp(24px, 4vw, 52px);
  font-size: 1.4rem;
}
.p-card.featured:hover {
  border-color: var(--accent);
  box-shadow: 0 20px 50px -20px rgba(28, 26, 23, 0.5);
}

/* dark mode: featured card blends with the dark page, accent border on hover */
body.dark .p-card.featured {
  background: var(--card);
  border-color: var(--line);
}
body.dark .p-card.featured h2 { color: var(--ink); }
body.dark .p-card.featured .name-dot { color: var(--accent); }
body.dark .p-card.featured:hover { border-color: var(--accent); }

/* services chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 36px;
}

.chip {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 9px 20px;
  transition: border-color 0.3s, color 0.3s;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }

/* ============ Contact ============ */
/* fills the viewport together with the footer below it */
.contact {
  min-height: calc(100svh - 96px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
}

.contact-title {
  font-family: var(--font-tech);
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.contact-title em { font-style: normal; color: var(--accent); }

.contact-sub {
  color: var(--ink-soft);
  max-width: 520px;
  margin-bottom: clamp(32px, 5vh, 52px);
}

.inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.25s;
}
.inline-link:hover { color: var(--ink); }

.contact-form { max-width: 720px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-field { margin-bottom: 20px; display: flex; flex-direction: column; }

.form-field label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.form-field input,
.form-field textarea {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.3s, box-shadow 0.3s;
  resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder { color: #b0a99e; }

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(224, 93, 56, 0.12);
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--ink);
  border: none;
  border-radius: 100px;
  padding: 16px 32px;
  cursor: pointer;
  transition: background 0.3s var(--ease), transform 0.3s var(--ease);
}
.submit-btn:hover { background: var(--accent); transform: translateY(-2px); }
.submit-btn .btn-arrow { transition: transform 0.3s var(--ease); }
.submit-btn:hover .btn-arrow { transform: translateX(5px); }
.submit-btn:disabled { opacity: 0.6; cursor: wait; }

.form-status {
  margin-top: 16px;
  font-size: 0.95rem;
  min-height: 1.4em;
}
.form-status.ok { color: #2e7d4f; }
body.dark .form-status.ok { color: #7fc79a; }
.form-status.err { color: var(--accent); }

/* ============ Footer ============ */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 32px clamp(20px, 5vw, 64px);
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.footer-links { display: flex; gap: 24px; }
.footer-links a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.25s;
}
.footer-links a:hover { color: var(--accent); }

/* ============ Responsive ============ */
@media (max-width: 860px) {
  .hero-ui { flex-direction: column; align-items: stretch; gap: 8px; }
  body.dark .hero-ui { align-items: flex-end; }
  .scene-ui { justify-content: space-between; row-gap: 8px; gap: 10px; padding: 10px 12px; border-radius: 12px; }
  .cam-ui { padding: 10px 12px; border-radius: 12px; }
  .cam-buttons { justify-content: space-between; gap: 4px; }
  .cam-btn { flex: 1; text-align: center; padding: 6px 10px; font-size: 0.72rem; }
  .hero-hint { display: none; }
  .ui-label { font-size: 0.58rem; margin-bottom: 5px; letter-spacing: 0.1em; }
  .swatch { width: 22px; height: 22px; }
  .swatches { gap: 6px; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .dot-nav { right: 6px; gap: 12px; }
  .dot-nav .dot { width: 8px; height: 8px; }
  .dot-nav .dot::after { display: none; }
  .form-row { grid-template-columns: 1fr; gap: 0; }

  .hero { min-height: 100svh; }
  .hero-copy {
    top: 78px;
    left: 14px;
    right: auto;
    padding: 12px 14px;
    border-radius: 14px;
  }
  .hero-name { font-size: 1.6rem; }
  .hero-role { font-size: 0.68rem; letter-spacing: 0.18em; margin-top: 6px; }
  .hero-tags { font-size: 0.58rem; margin-top: 8px; line-height: 1.7; }

  /* smaller header controls */
  .site-header { padding: 12px 16px; }
  .logo-mark { width: 34px; height: 34px; }
  .site-nav { gap: 10px; }
  .site-nav a { font-size: 0.78rem; }
  .nav-cta { padding: 5px 12px; }
  .theme-toggle { width: 28px; height: 28px; }
  .theme-toggle svg { width: 13px; height: 13px; }

  .hero-ui { left: 10px; right: 10px; bottom: 10px; gap: 6px; }
  .scene-ui { border-radius: 10px; padding: 8px 10px; gap: 8px; row-gap: 6px; }
  .cam-ui { border-radius: 10px; padding: 8px 10px; }
  .ui-label { margin-bottom: 4px; font-size: 0.52rem; letter-spacing: 0.08em; }
  .swatch { width: 20px; height: 20px; border-width: 1px; }
  .swatch.active { box-shadow: 0 0 0 1px var(--bg), 0 0 0 3px var(--accent); }
  .swatches { gap: 5px; }
  .cam-buttons { gap: 3px; }
  .cam-btn { padding: 5px 7px; font-size: 0.62rem; letter-spacing: 0.02em; }

  .section { padding: 56px 20px; }
  .p-card { padding: 22px 20px 26px; }
  .chips { margin-top: 28px; }
  .chip { font-size: 0.8rem; padding: 8px 16px; }
  .submit-btn { width: 100%; justify-content: center; }
  .site-footer { flex-direction: column; align-items: flex-start; }
}

/* very small phones: keep panels compact */
@media (max-width: 380px) {
  .scene-ui { gap: 6px; padding: 7px 8px; }
  .cam-ui { padding: 7px 8px; }
  .swatch { width: 18px; height: 18px; }
  .swatches { gap: 4px; }
  .cam-btn { padding: 4px 5px; font-size: 0.58rem; }
  .ui-label { font-size: 0.48rem; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-copy, .hero-ui, .hero-hint { animation: none; opacity: 1; }
  #scene-canvas { opacity: 1; transition: none; }
}
