/* ═══════════════════════════════════════════════════════════════════════════
   SONIKI SOFTWARE — soniki.com.tr
   Requires tokens.css to be loaded first.

   Unlayered rules beat layered ones, so anything appended at the very bottom
   of this file automatically wins over everything above it. That is intended:
   it gives a future editor a safe place to put ad-hoc overrides.
   ═══════════════════════════════════════════════════════════════════════════ */

@layer reset, base, layout, nav, components, sections, footer, responsive;

/* ── RESET ─────────────────────────────────────────────────────────────── */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
  ul[class], ol[class] { list-style: none; padding: 0; }
  img, svg, picture { display: block; max-width: 100%; }
  button, input, select, textarea { font: inherit; color: inherit; }
  a { color: inherit; text-decoration: none; }
}

/* ── BASE ──────────────────────────────────────────────────────────────── */
@layer base {
  html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 12px);
    overflow-x: clip;
  }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: var(--t-body);
    line-height: var(--lh-body);
    letter-spacing: var(--tr-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
  }

  h1, h2, h3 { text-wrap: balance; font-weight: var(--w-semi); }
  h1 { font-size: var(--t-h1);   line-height: var(--lh-head);  letter-spacing: var(--tr-h1); }
  h2 { font-size: var(--t-h2);   line-height: var(--lh-head);  letter-spacing: var(--tr-h2); }
  h3 { font-size: var(--t-h3);   line-height: 1.25;            letter-spacing: var(--tr-h3); }

  p { text-wrap: pretty; }

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

  ::selection { background: var(--sk-ultramarine); color: #fff; }

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

  .skip {
    position: absolute; left: -9999px; top: 0; z-index: 2000;
    background: var(--sk-black); color: #fff;
    padding: 12px 20px; border-radius: 0 0 var(--r-sm) 0;
  }
  .skip:focus { left: 0; }
}

/* ── LAYOUT ────────────────────────────────────────────────────────────── */
@layer layout {
  .wrap       { width: 100%; max-width: var(--wrap);      margin-inline: auto; padding-inline: var(--gutter); }
  .wrap > *   { min-width: 0; }
  .wrap--wide { max-width: var(--wrap-wide); }
  .measure    { max-width: min(var(--wrap-text), 100%); }

  section[data-surface] {
    background: var(--bg);
    color: var(--fg);
    padding-block: var(--section-y);
  }

  .stack   { display: flex; flex-direction: column; }
  .stack-3 { gap: var(--s-3); }
  .stack-4 { gap: var(--s-4); }
  .stack-6 { gap: var(--s-6); }
  .stack-8 { gap: var(--s-8); }
}

/* ── NAV ───────────────────────────────────────────────────────────────── */
@layer nav {
  .nav {
    position: sticky; top: 0; z-index: var(--z-nav);
    height: var(--nav-h);
    background: rgba(251, 251, 253, 0.72);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transition: background var(--dur-fast) var(--ease);
  }

  .nav__inner {
    height: 100%;
    max-width: var(--wrap-wide);
    margin-inline: auto;
    padding-inline: var(--gutter);
    display: flex; align-items: center; gap: var(--s-6);
  }

  .nav__logo { flex: none; display: flex; align-items: center; }
  .nav__logo img { height: 18px; width: auto; }
  .nav__logo .logo--light { display: block; }
  .nav__logo .logo--dark  { display: none; }

  .nav__links {
    display: flex; align-items: center; gap: var(--s-6);
    margin-inline-start: auto;
    font-size: var(--t-micro);
    letter-spacing: -0.01em;
  }

  .nav__links a {
    color: rgba(0, 0, 0, 0.86);
    opacity: 0.86;
    transition: opacity var(--dur-fast) var(--ease);
    white-space: nowrap;
  }
  .nav__links a:hover           { opacity: 1; }
  .nav__links a[aria-current]   { opacity: 1; font-weight: var(--w-medium); }

  /* The nav follows the surface beneath it. A white translucent bar sitting on
     a black hero reads as a mistake; this inverts it while the hero is under
     the nav line, then hands back to light. Driven by one sentinel element and
     one IntersectionObserver — see soniki.js. Without JS the nav simply stays
     light, which is legible on every surface, just less elegant. */
  .nav[data-theme="dark"] {
    background: rgba(0, 0, 0, 0.60);
    border-bottom-color: rgba(255, 255, 255, 0.13);
  }
  .nav[data-theme="dark"] .nav__links a { color: rgba(255, 255, 255, 0.92); }
  .nav[data-theme="dark"] .nav__toggle  { color: #fff; }
  .nav[data-theme="dark"] .logo--light  { display: none; }
  .nav[data-theme="dark"] .logo--dark   { display: block; }

  .lang { display: flex; align-items: center; gap: 5px; }
  .lang a          { opacity: 0.5; }
  .lang a:hover    { opacity: 1; }
  .lang a[aria-current] { opacity: 1; font-weight: var(--w-semi); }
  .lang__sep       { opacity: 0.3; }

  /* mobile menu button — hidden on desktop */
  .nav__toggle {
    display: none;
    margin-inline-start: auto;
    background: none; border: 0; padding: var(--s-2);
    cursor: pointer; color: inherit;
  }
  .nav__toggle svg { width: 20px; height: 20px; }
}

/* ── COMPONENTS ────────────────────────────────────────────────────────── */
@layer components {

  .eyebrow {
    font-size: var(--t-micro);
    font-weight: var(--w-semi);
    letter-spacing: var(--tr-eyebrow);
    text-transform: uppercase;
    color: var(--fg-muted);
  }

  .lead {
    font-size: var(--t-lead);
    line-height: var(--lh-lead);
    letter-spacing: -0.006em;
    color: var(--fg-muted);
  }

  /* buttons ------------------------------------------------------------- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: var(--s-2);
    min-height: 44px;
    padding: 0 var(--s-6);
    border-radius: var(--r-pill);
    font-size: var(--t-small);
    font-weight: var(--w-medium);
    letter-spacing: -0.01em;
    white-space: nowrap;
    transition: transform var(--dur-fast) var(--ease),
                opacity var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease);
  }
  .btn:active { transform: scale(0.97); }

  .btn--primary {
    background: var(--link);
    color: #fff;
  }
  .btn--primary:hover { opacity: 0.88; }

  .btn--ghost {
    border: 1px solid var(--fg);
    color: var(--fg);
  }
  .btn--ghost:hover { background: var(--fg); color: var(--bg); }

  /* text link with chevron ---------------------------------------------- */
  .arrow {
    display: inline-flex; align-items: center; gap: 3px;
    color: var(--link);
    font-size: var(--t-small);
    font-weight: var(--w-medium);
  }
  .arrow::after {
    content: "\203A";
    font-size: 1.25em; line-height: 1;
    transform: translateY(-0.06em);
    transition: transform var(--dur-fast) var(--ease);
  }
  .arrow:hover::after { transform: translate(3px, -0.06em); }

  .btn-row { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; }

  /* section head -------------------------------------------------------- */
  .head { display: flex; flex-direction: column; gap: var(--s-4); margin-bottom: var(--s-12); }
  .head .lead { max-width: min(var(--wrap-text), 100%); }
  .head--center { align-items: center; text-align: center; }
  .head--center .lead { margin-inline: auto; }

  /* bento grid ---------------------------------------------------------- */
  .bento {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--s-4);
  }
  .bento__card {
    min-width: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-rule);
    border-radius: var(--r-lg);
    padding: var(--s-8);
    display: flex; flex-direction: column; gap: var(--s-3);
    min-height: 232px;
  }
  .bento__card h3 { margin-bottom: var(--s-1); }
  .bento__card p  { color: var(--fg-muted); font-size: var(--t-small); line-height: 1.5; }
  .bento__card--4 { grid-column: span 4; }
  .bento__card--3 { grid-column: span 3; }
  .bento__card--2 { grid-column: span 2; }

  .bento__icon {
    width: 26px; height: 26px;
    margin-bottom: var(--s-2);
    color: var(--fg);
    opacity: 0.9;
  }

  /* framework chips ----------------------------------------------------- */
  .chips { display: flex; flex-wrap: wrap; gap: var(--s-3); }
  .chip {
    background: var(--chip-bg);
    border: 1px solid var(--card-rule);
    border-radius: var(--r-pill);
    padding: 10px var(--s-5);
    font-size: var(--t-small);
    font-weight: var(--w-medium);
    letter-spacing: -0.008em;
  }

  /* two-column feature list --------------------------------------------- */
  .cols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-10);
  }
  .cols--3 { grid-template-columns: repeat(3, 1fr); }
  .col h3 { margin-bottom: var(--s-2); }
  .col p  { color: var(--fg-muted); font-size: var(--t-small); line-height: 1.55; }

  /* checklist ----------------------------------------------------------- */
  .ticks { display: grid; gap: var(--s-3); }
  .ticks li {
    display: grid; grid-template-columns: 22px 1fr; gap: var(--s-3);
    align-items: start;
    font-size: var(--t-small);
    color: var(--fg-muted);
  }
  .ticks li::before {
    content: "";
    width: 18px; height: 18px; margin-top: 3px;
    border-radius: 50%;
    background: var(--link);
    -webkit-mask: no-repeat center / 10px 10px
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1 6.2l3.2 3.2L11 2.6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    mask: no-repeat center / 10px 10px
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1 6.2l3.2 3.2L11 2.6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
  .ticks b { color: var(--fg); font-weight: var(--w-semi); }

  /* division lockup grid ------------------------------------------------ */
  .divisions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-4);
  }
  .division {
    min-width: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-rule);
    border-radius: var(--r-md);
    padding: var(--s-6);
    display: flex; flex-direction: column; gap: var(--s-4);
    min-height: 150px;
  }
  .division img { width: 100%; max-width: 214px; height: auto; }
  .division p   { color: var(--fg-muted); font-size: var(--t-small); line-height: 1.5; }

  /* reveal -------------------------------------------------------------- */
  .js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, var(--reveal-y), 0);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
    transition-delay: calc(var(--i, 0) * var(--reveal-stagger));
    will-change: opacity, transform;
  }
  .js [data-reveal="in"] {
    opacity: 1;
    transform: none;
    will-change: auto;
  }
}

/* ── SECTIONS ──────────────────────────────────────────────────────────── */
@layer sections {

  /* hero ---------------------------------------------------------------- */
  .hero {
    padding-block: clamp(5rem, 3rem + 12vw, 11rem) clamp(4.5rem, 3rem + 8vw, 8rem);
    text-align: center;
  }
  .hero__lockup {
    width: min(100%, 420px);
    height: auto;
    margin: 0 auto var(--s-10);
  }
  .hero h1 {
    font-size: var(--t-hero);
    line-height: var(--lh-tight);
    letter-spacing: var(--tr-hero);
    font-weight: var(--w-semi);
    max-width: min(18ch, 100%);
    margin-inline: auto;
  }
  .hero .lead {
    max-width: min(52ch, 100%);
    margin: var(--s-6) auto 0;
  }
  .hero .btn-row { justify-content: center; margin-top: var(--s-10); }

  /* product intro ------------------------------------------------------- */
  .product__lockup { width: min(100%, 300px); height: auto; margin-bottom: var(--s-8); }

  .split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2rem, 1rem + 5vw, 5rem);
    align-items: center;
  }

  /* accreditation ------------------------------------------------------- */
  .frameworks { margin-top: var(--s-10); }

  /* roles --------------------------------------------------------------- */
  .roles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--s-8) var(--s-6);
    margin-top: var(--s-12);
  }
  .role__n {
    font-size: var(--t-h3);
    font-weight: var(--w-semi);
    letter-spacing: var(--tr-h3);
    padding-bottom: var(--s-3);
    margin-bottom: var(--s-3);
    border-bottom: 1px solid var(--rule);
  }
  .role p { color: var(--fg-muted); font-size: var(--t-small); line-height: 1.55; }

  /* contact ------------------------------------------------------------- */
  .contact__cta { margin-top: var(--s-10); }
  .contact__lines {
    display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-10);
    margin-top: var(--s-10);
    padding-top: var(--s-8);
    border-top: 1px solid var(--rule);
  }
  .contact__line { display: flex; flex-direction: column; gap: 4px; }
  .contact__line .eyebrow { font-size: 0.6875rem; }
  .contact__line a, .contact__line span {
    font-size: var(--t-lead);
    font-weight: var(--w-medium);
    letter-spacing: -0.01em;
  }
  .contact__line a:hover { color: var(--link); }
}

/* ── FOOTER ────────────────────────────────────────────────────────────── */
@layer footer {
  .foot {
    background: var(--bg);
    color: var(--fg);
    padding-block: var(--s-16) var(--s-10);
    font-size: var(--t-micro);
    line-height: 1.55;
  }
  .foot__logo img { height: 20px; width: auto; margin-bottom: var(--s-8); }

  .foot__cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--s-8) var(--s-6);
    padding-bottom: var(--s-10);
    border-bottom: 1px solid var(--rule);
  }
  .foot__col h4 {
    font-size: var(--t-micro);
    font-weight: var(--w-semi);
    margin-bottom: var(--s-3);
  }
  .foot__col ul { display: grid; gap: var(--s-2); }
  .foot__col a { color: var(--fg-muted); }
  .foot__col a:hover { color: var(--fg); }

  .foot__legal {
    padding-top: var(--s-6);
    display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-6);
    justify-content: space-between;
    color: var(--fg-muted);
  }
}

/* ── RESPONSIVE ────────────────────────────────────────────────────────── */
@layer responsive {
  @media (max-width: 900px) {
    .bento { grid-template-columns: repeat(2, 1fr); }
    .divisions { grid-template-columns: repeat(2, 1fr); }
    .cols--3 { grid-template-columns: repeat(2, 1fr); }
    .bento__card--4, .bento__card--3, .bento__card--2 { grid-column: span 1; }
    .split { grid-template-columns: 1fr; }
  }

  @media (max-width: 760px) {
    .nav__links {
      position: fixed; inset: var(--nav-h) 0 auto 0;
      z-index: var(--z-menu);
      flex-direction: column; align-items: stretch; gap: 0;
      background: rgba(251, 251, 253, 0.96);
      -webkit-backdrop-filter: saturate(180%) blur(20px);
      backdrop-filter: saturate(180%) blur(20px);
      border-bottom: 1px solid rgba(0, 0, 0, 0.08);
      padding: var(--s-2) var(--gutter) var(--s-6);
      font-size: var(--t-body);
      transform: translateY(-8px);
      opacity: 0; visibility: hidden; pointer-events: none;
      transition: opacity var(--dur-fast) var(--ease),
                  transform var(--dur-fast) var(--ease),
                  visibility var(--dur-fast);
    }
    .nav__links a {
      padding-block: var(--s-4);
      border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }
    .nav[data-open="true"] .nav__links {
      opacity: 1; visibility: visible; pointer-events: auto;
      transform: none;
    }
    .nav[data-theme="dark"] .nav__links {
      background: rgba(0, 0, 0, 0.94);
      border-bottom-color: rgba(255, 255, 255, 0.13);
    }
    .nav[data-theme="dark"] .nav__links a {
      border-bottom-color: rgba(255, 255, 255, 0.08);
    }
    .nav__toggle { display: block; }
    .lang { padding-block: var(--s-4); }

    .bento { grid-template-columns: 1fr; }
    .bento__card { min-height: 0; padding: var(--s-6); }
    .divisions, .cols, .cols--3 { grid-template-columns: 1fr; }
    .cols { gap: var(--s-8); }
    .contact__lines { gap: var(--s-6); }
  }

  @media (max-width: 400px) {
    .hero__lockup { width: min(100%, 300px); }
    .division img { max-width: 100%; }
  }
}

/* ── REDUCED MOTION ────────────────────────────────────────────────────────
   Deliberately unlayered so it beats everything above without !important
   fights. `scroll-behavior` is the one people forget, and on a long-scroll
   page it is the single most common trigger for vestibular discomfort.
   ─────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── PRINT ─────────────────────────────────────────────────────────────── */
@media print {
  .nav, .foot__cols, .btn-row { display: none; }
  section[data-surface] { background: #fff !important; color: #000 !important; padding-block: 1.5rem; }
  a::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
