/* =================================================================
   Kenan Jallad — Site Design System
   Shared stylesheet for index.html and case study pages
   Aesthetic: schematic minimalism + organic disruption
   ================================================================= */

/* ---------------------------------------------------------------
   RESET
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------------------------------------------------------------
   DESIGN TOKENS
   --------------------------------------------------------------- */
:root {
  /* Palette — inherited from case study + logo */
  --bg-paper:        #f6f5f4;
  --bg-card:         #e8e7e5;
  --ink-primary:     #292a2c;
  --ink-secondary:   #5f5e5a;
  --ink-tertiary:    #888780;
  --ink-quaternary:  #b4b2a9;
  --accent-rust:     #c63412;
  --accent-oxblood:  #320d05;
  --accent-rust-shadow: #a02a0e;

  --rule-faint:      rgba(41, 42, 44, 0.10);
  --rule-medium:     rgba(41, 42, 44, 0.18);
  --rule-strong:     rgba(41, 42, 44, 0.45);

  /* Organic washes */
  --wash-rust-soft:  rgba(198, 52, 18, 0.07);
  --wash-rust-mid:   rgba(198, 52, 18, 0.12);
  --wash-ochre:      rgba(180, 140, 70, 0.09);
  --wash-oxblood:    rgba(50, 13, 5, 0.06);
  --wash-ink-soft:   rgba(41, 42, 44, 0.04);

  /* Typography */
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ---------------------------------------------------------------
   PAGE BASE
   --------------------------------------------------------------- */
html, body {
  background: var(--bg-paper);
  color: var(--ink-primary);
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---------------------------------------------------------------
   ORGANIC FIELD — fixed blurred radial washes
   --------------------------------------------------------------- */
.organic-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.85;
  will-change: transform;
}

.blob--one {
  width: 520px; height: 520px;
  top: -120px; left: -180px;
  background: radial-gradient(circle at 35% 40%, var(--wash-rust-mid) 0%, var(--wash-rust-soft) 45%, transparent 70%);
  animation: drift-one 28s ease-in-out infinite alternate;
}
.blob--two {
  width: 640px; height: 640px;
  top: 30%; right: -260px;
  background: radial-gradient(circle at 60% 50%, var(--wash-ochre) 0%, transparent 65%);
  animation: drift-two 36s ease-in-out infinite alternate;
}
.blob--three {
  width: 460px; height: 460px;
  bottom: -180px; left: 18%;
  background: radial-gradient(circle at 50% 50%, var(--wash-rust-soft) 0%, transparent 70%);
  animation: drift-three 32s ease-in-out infinite alternate;
}
.blob--four {
  width: 380px; height: 380px;
  top: 60%; left: -100px;
  background: radial-gradient(circle at 50% 50%, var(--wash-ink-soft) 0%, transparent 65%);
  animation: drift-four 40s ease-in-out infinite alternate;
}

/* Welcome page uses a softer two-blob variant */
.organic-field--minimal .blob--two {
  width: 540px; height: 540px;
  top: auto; bottom: -180px; right: -160px;
  background: radial-gradient(circle at 50% 50%, var(--wash-oxblood) 0%, transparent 70%);
  animation-duration: 44s;
}
.organic-field--minimal .blob--three,
.organic-field--minimal .blob--four { display: none; }

@keyframes drift-one {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 60px) scale(1.08); }
}
@keyframes drift-two {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-50px, -40px) scale(1.06); }
}
@keyframes drift-three {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, -30px) scale(1.1); }
}
@keyframes drift-four {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-30px, 40px) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .blob { animation: none !important; }
}

/* ---------------------------------------------------------------
   SCHEMATIC FRAME — corner registration marks
   --------------------------------------------------------------- */
.sheet-frame {
  position: fixed;
  inset: 24px;
  pointer-events: none;
  z-index: 1;
}
.sheet-frame::before,
.sheet-frame::after,
.sheet-frame > span::before,
.sheet-frame > span::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--rule-strong);
  border-style: solid;
  border-width: 0;
}
.sheet-frame::before {
  top: 0; left: 0;
  border-top-width: 1px;
  border-left-width: 1px;
}
.sheet-frame::after {
  top: 0; right: 0;
  border-top-width: 1px;
  border-right-width: 1px;
}
.sheet-frame > span {
  display: block; width: 100%; height: 100%; position: relative;
}
.sheet-frame > span::before {
  bottom: 0; left: 0;
  border-bottom-width: 1px;
  border-left-width: 1px;
}
.sheet-frame > span::after {
  bottom: 0; right: 0;
  border-bottom-width: 1px;
  border-right-width: 1px;
}

/* ---------------------------------------------------------------
   SHEET MARKS — four-corner mono-labels
   --------------------------------------------------------------- */
.sheet-mark {
  position: fixed;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-quaternary);
  z-index: 4; /* above the homemark so it's clickable */
  pointer-events: none;
}
.sheet-mark--tl { top: 32px; left: 48px; }
.sheet-mark--tr { top: 32px; right: 48px; }
.sheet-mark--bl { bottom: 32px; left: 48px; }
.sheet-mark--br { bottom: 32px; right: 48px; }
.sheet-mark span { color: var(--accent-rust); }

/* Home-mark variant: the top-left mark contains the logo + wordmark,
   and is clickable. Lives in the .sheet-mark--tl slot. */
.homemark {
  position: fixed;
  top: 28px;
  left: 48px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  padding: 4px 8px 4px 4px;
  margin: -4px -8px -4px -4px; /* expand hit area without shifting visual */
  border-radius: 4px;
  transition: color 0.25s ease, background-color 0.25s ease;
}
.homemark:hover { color: var(--accent-rust); background: rgba(198, 52, 18, 0.04); }
.homemark__logo {
  width: 22px;
  height: auto;
  flex-shrink: 0;
  display: block;
}
.homemark__name { line-height: 1; padding-top: 1px; }

/* ---------------------------------------------------------------
   TYPOGRAPHY — shared display heading idioms
   --------------------------------------------------------------- */
.index-line {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-rust);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.index-line::before {
  content: "";
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--accent-rust);
}

/* ---------------------------------------------------------------
   PAGE-LOAD REVEAL
   --------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.reveal--1 { animation-delay: 0.05s; }
.reveal--2 { animation-delay: 0.18s; }
.reveal--3 { animation-delay: 0.32s; }
.reveal--4 { animation-delay: 0.46s; }
.reveal--5 { animation-delay: 0.60s; }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; animation: none; }
}

/* ---------------------------------------------------------------
   CHROME BARS — frosted top/bottom overlay for fixed UI elements
   Prevents sheet marks from clashing with scrolled page content.
   Semi-opaque paper tone (~85%) + backdrop blur + inner rule line.
   --------------------------------------------------------------- */
.chrome-bar {
  position: fixed;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 3; /* above sheet-frame (1), below sheet-marks (4) */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chrome-bar--top {
  top: 0;
  height: 64px;
  background: linear-gradient(
    to bottom,
    rgba(246, 245, 244, 0.92) 0%,
    rgba(246, 245, 244, 0.85) 60%,
    rgba(246, 245, 244, 0.00) 100%
  );
}

.chrome-bar--bottom {
  bottom: 0;
  height: 64px;
  background: linear-gradient(
    to top,
    rgba(246, 245, 244, 0.92) 0%,
    rgba(246, 245, 244, 0.85) 60%,
    rgba(246, 245, 244, 0.00) 100%
  );
}

/* Minimized state on scroll */
body.is-scrolled .chrome-bar--top    { height: 48px; }
body.is-scrolled .chrome-bar--bottom { height: 48px; }

@media (max-width: 720px) {
  .chrome-bar--top    { height: 48px; }
  .chrome-bar--bottom { height: 48px; }
  body.is-scrolled .chrome-bar--top    { height: 36px; }
  body.is-scrolled .chrome-bar--bottom { height: 36px; }
}

/* ---------------------------------------------------------------
   RESPONSIVE — shared frame adjustments
   --------------------------------------------------------------- */
@media (max-width: 720px) {
  .sheet-frame { inset: 12px; }
  .sheet-mark { font-size: 9px; letter-spacing: 0.12em; }
  .sheet-mark--tl, .sheet-mark--tr { top: 18px; }
  .sheet-mark--bl, .sheet-mark--br { bottom: 18px; }
  .sheet-mark--tl, .sheet-mark--bl { left: 22px; }
  .sheet-mark--tr, .sheet-mark--br { right: 22px; }

  .homemark { top: 14px; left: 22px; font-size: 9px; gap: 0.5rem; }
  .homemark__logo { width: 18px; }
}

@media (max-width: 420px) {
  .sheet-mark--bl, .sheet-mark--br { display: none; }
}
