/* Nile Apps — nileapps.co.uk
   Single stylesheet, no build step, no framework, no CDN.
   Identity: ink neutrals + a single indigo accent. Distinct from PawCal's teal.
   Theming: auto via prefers-color-scheme, plus an explicit [data-theme] override
   the nav toggle sets and remembers. */

:root {
  --bg:        #FFFFFF;
  --bg-2:      #F6F7F9;
  --surface:   #FFFFFF;
  --card:      #FFFFFF;
  --ink:       #0B0E14;
  --ink-2:     #333A48;
  --muted:     #515A6B;
  --accent-text: #4F46E5;   /* links, eyebrows — 5.9:1 on white */
  --accent-soft: #EEF0FE;   /* faint accent wash */
  --btn-bg:    #4F46E5;
  --btn-bg-h:  #4338CA;
  --btn-ink:   #FFFFFF;
  --line:      #E5E7EB;
  --line-2:    #EDEFF2;
  --ring:      rgba(79, 70, 229, .45);
  --shadow:    0 20px 45px -24px rgba(16, 20, 40, .28);
  --shadow-sm: 0 6px 18px -12px rgba(16, 20, 40, .20);
  --maxw:      1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* Follow the OS when the user hasn't chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:        #0A0B0F;
    --bg-2:      #0E1015;
    --surface:   #12141A;
    --card:      #14161D;
    --ink:       #F1F3F7;
    --ink-2:     #C6CCD8;
    --muted:     #98A1B3;
    --accent-text: #A5B4FC;   /* indigo-300 — ~9:1 on the dark ground */
    --accent-soft: #171A2B;
    --btn-bg:    #5B54E8;
    --btn-bg-h:  #4F46E5;
    --btn-ink:   #FFFFFF;
    --line:      #22262F;
    --line-2:    #1A1D25;
    --ring:      rgba(165, 180, 252, .55);
    --shadow:    0 24px 60px -28px rgba(0, 0, 0, .75);
    --shadow-sm: 0 8px 24px -14px rgba(0, 0, 0, .65);
  }
}

/* Explicit choice from the toggle wins over the OS. */
:root[data-theme="light"] {
  --bg: #FFFFFF; --bg-2: #F6F7F9; --surface: #FFFFFF; --card: #FFFFFF;
  --ink: #0B0E14; --ink-2: #333A48; --muted: #515A6B;
  --accent-text: #4F46E5; --accent-soft: #EEF0FE;
  --btn-bg: #4F46E5; --btn-bg-h: #4338CA; --btn-ink: #FFFFFF;
  --line: #E5E7EB; --line-2: #EDEFF2; --ring: rgba(79, 70, 229, .45);
  --shadow: 0 20px 45px -24px rgba(16, 20, 40, .28);
  --shadow-sm: 0 6px 18px -12px rgba(16, 20, 40, .20);
}
:root[data-theme="dark"] {
  --bg: #0A0B0F; --bg-2: #0E1015; --surface: #12141A; --card: #14161D;
  --ink: #F1F3F7; --ink-2: #C6CCD8; --muted: #98A1B3;
  --accent-text: #A5B4FC; --accent-soft: #171A2B;
  --btn-bg: #5B54E8; --btn-bg-h: #4F46E5; --btn-ink: #FFFFFF;
  --line: #22262F; --line-2: #1A1D25; --ring: rgba(165, 180, 252, .55);
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, .75);
  --shadow-sm: 0 8px 24px -14px rgba(0, 0, 0, .65);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
svg { display: block; }

/* Keyboard focus, always visible. */
:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.eyebrow {
  font-size: 12.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent-text);
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; }
h1 { font-size: clamp(2.3rem, 6vw, 3.8rem); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 700; }
p  { margin: 0; }

.muted { color: var(--muted); }
.lead  { font-size: clamp(1.05rem, 2.2vw, 1.28rem); color: var(--ink-2); }

/* Skip link */
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--btn-bg); color: var(--btn-ink);
  padding: 10px 16px; border-radius: 10px; font-weight: 600;
  transition: top .18s ease;
}
.skip:focus { top: 12px; text-decoration: none; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; letter-spacing: -0.02em; font-size: 1.06rem; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto; box-shadow: var(--shadow-sm); }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { color: var(--ink-2); font-weight: 600; font-size: .95rem; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 12px; }

/* Theme toggle */
.toggle {
  width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.toggle:hover { border-color: var(--accent-text); }
.toggle .sun { display: none; }
.toggle .moon { display: block; }
:root[data-theme="dark"] .toggle .sun { display: block; }
:root[data-theme="dark"] .toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .toggle .sun { display: block; }
  :root:not([data-theme]) .toggle .moon { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 650; font-size: .98rem; line-height: 1;
  padding: 13px 20px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent; transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--btn-bg); color: var(--btn-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--btn-bg-h); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent-text); color: var(--accent-text); }

/* ---------- Sections ---------- */
section { padding: clamp(64px, 9vw, 108px) 0; }
.section-head { max-width: 640px; margin: 0 0 40px; }
.section-head p { margin-top: 12px; }
.alt { background: var(--bg-2); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: clamp(56px, 8vw, 92px); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero h1 { margin-bottom: 20px; }
.hero .lead { max-width: 34ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-meta { margin-top: 26px; color: var(--muted); font-size: .92rem; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-text); flex: 0 0 auto; }

/* Decorative "current" panel on the right of the hero */
.hero-art {
  position: relative; aspect-ratio: 1 / 1; border-radius: 24px;
  background: #0a0b12;
  border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden;
}
.hero-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-badge {
  position: absolute; left: 20px; bottom: 20px; right: 20px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; gap: 12px; font-size: .9rem; color: var(--ink-2);
}
.hero-badge b { color: var(--ink); }

/* ---------- Work / case study ---------- */
.case { display: grid; grid-template-columns: 1fr 240px; gap: 40px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: clamp(22px, 3.4vw, 36px); box-shadow: var(--shadow-sm); }
.case h3 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.02em; }
.case-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.pill {
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent-text) 30%, transparent);
  padding: 4px 10px; border-radius: 999px;
}
.case p { margin-bottom: 18px; color: var(--ink-2); }
.taglist { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 22px; padding: 0; list-style: none; }
.taglist li {
  font-size: .82rem; color: var(--muted); font-family: var(--mono);
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; background: var(--surface);
}
.case-link { font-weight: 650; display: inline-flex; align-items: center; gap: 6px; }

/* Phone frame */
.phone {
  justify-self: center; width: 190px; aspect-ratio: 600 / 1298;
  border-radius: 34px; padding: 10px;
  background: linear-gradient(180deg, #1b1e26, #0c0e13);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,.06);
}
.phone img { width: 100%; height: 100%; object-fit: cover; border-radius: 25px; display: block; }
.note-more { margin-top: 22px; color: var(--muted); font-size: .95rem; }

/* ---------- Services ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.svc {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 26px; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.svc:hover { border-color: color-mix(in srgb, var(--accent-text) 45%, var(--line)); box-shadow: var(--shadow-sm); }
.svc .ico {
  width: 42px; height: 42px; border-radius: 11px; margin-bottom: 16px;
  background: var(--accent-soft); color: var(--accent-text);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid color-mix(in srgb, var(--accent-text) 26%, transparent);
}
.svc h3 { margin-bottom: 8px; }
.svc p { color: var(--muted); font-size: .97rem; }

/* ---------- Contact ---------- */
.contact-card {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(28px, 5vw, 56px);
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: clamp(26px, 5vw, 52px); box-shadow: var(--shadow);
  background-image: radial-gradient(120% 140% at 0% -20%, var(--accent-soft), transparent 55%);
}
.contact-intro h2 { margin: 6px 0 12px; }
.contact-intro > p { max-width: 40ch; margin: 0 0 24px; color: var(--ink-2); }
.mail { font-family: var(--mono); font-size: .98rem; }

.channels { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.channels li { display: flex; align-items: center; gap: 12px; }
.channels .ch-ico {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-text);
  border: 1px solid color-mix(in srgb, var(--accent-text) 26%, transparent);
  display: inline-flex; align-items: center; justify-content: center;
}
.channels .ch-label { display: block; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; }
.channels a { font-weight: 650; color: var(--accent-text); }

/* Contact form */
.contact-form { display: grid; gap: 14px; align-content: start; text-align: left; }
.field { display: grid; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field .opt { color: var(--muted); font-weight: 400; }
.contact-form input, .contact-form select, .contact-form textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.contact-form textarea { resize: vertical; min-height: 96px; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus {
  outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--ring);
}
.contact-form .btn { margin-top: 4px; justify-content: center; }
.contact-form button[disabled] { opacity: .6; cursor: progress; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.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; }
.form-status { font-size: .9rem; min-height: 1.2em; margin: 2px 0 0; font-weight: 600; }
.form-status.ok { color: #15803D; }
.form-status.err { color: #B91C1C; }
:root[data-theme="dark"] .form-status.ok { color: #4ADE80; }
:root[data-theme="dark"] .form-status.err { color: #F87171; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .form-status.ok { color: #4ADE80; }
  :root:not([data-theme]) .form-status.err { color: #F87171; }
}
.form-fine { font-size: .8rem; color: var(--muted); margin: 0; }

@media (max-width: 760px) {
  .contact-card { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 34px 0 44px; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot .brand { font-size: 1rem; }
.foot-meta { color: var(--muted); font-size: .9rem; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.foot-meta a { color: var(--muted); }
.foot-meta a:hover { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .hero .lead { max-width: 46ch; }
  .hero-art { max-width: 420px; margin: 0 auto; width: 100%; }
  .case { grid-template-columns: 1fr; gap: 30px; }
  .phone { order: -1; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .wrap { padding: 0 20px; }
  .nav-links { display: none; }
  .grid { grid-template-columns: 1fr; }
  .hero-cta .btn { flex: 1 1 auto; }
}
@media (max-width: 360px) {
  .wrap { padding: 0 16px; }
  .foot { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
