/* =========================================================
   karakich.de — Ahmad Karakich
   Elegant, typography-first design. Monochrome by default.
   Hand-written CSS, no frameworks, no build step.
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --wrap: 1000px;
  --text-col: 68ch;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --radius: 4px;
  --ease: cubic-bezier(.25, .8, .3, 1);
}

/* Paper (light theme) */
[data-theme="light"] {
  --bg: #fafafa;
  --bg-soft: #ffffff;
  --ink: #171717;
  --ink-soft: #4a4a4a;
  --muted: #7f7f7f;
  --line: #e4e4e4;
  --line-strong: #cfcfcf;
  --hover: rgba(0, 0, 0, .035);
}

/* Ink (dark — default) */
[data-theme="dark"] {
  --bg: #121212;
  --bg-soft: #171717;
  --ink: #ececec;
  --ink-soft: #b3b3b3;
  --muted: #7f7f7f;
  --line: #262626;
  --line-strong: #3a3a3a;
  --hover: rgba(255, 255, 255, .04);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.72;
  color: var(--ink-soft);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- National motif: Lebanese flag, very faint, fixed behind content ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url("flag.svg") no-repeat center 44% / min(76vw, 940px) auto;
  opacity: .085;
  pointer-events: none;
}
[data-theme="light"] body::before { opacity: .055; }

/* ---------- Interactive dot grid (cursor-reactive layer, above the flag) ---------- */
.dot-grid {
  position: fixed;
  inset: 0;
  display: block;
  z-index: -1;
  pointer-events: none;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.22;
  letter-spacing: -.01em;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 400; }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1.15em; }
strong { color: var(--ink); font-weight: 600; }
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-strong); transition: border-color .2s var(--ease); }
a:hover { border-color: var(--ink); }
svg { max-width: 100%; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 26px; }
.muted { color: var(--muted); font-size: .9rem; }
.accent, .grad { font-style: italic; color: var(--ink); }
.aurora { display: none; }  /* legacy markup from the previous design */

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 16px;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 3px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 72px; }

.brand { display: flex; align-items: center; gap: 12px; border: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: var(--font-serif);
  font-size: .8rem; letter-spacing: .02em;
  color: var(--ink);
}
.brand-text { display: block; font-family: var(--font-serif); font-size: 1.02rem; color: var(--ink); }
.brand-tag { display: block; font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }

.nav { display: flex; align-items: center; gap: 26px; }
.nav a {
  border: 0;
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); padding: 6px 0; position: relative;
  transition: color .2s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after,
.nav a:hover::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--ink);
}
.nav-cta { color: var(--ink) !important; border-bottom: 1px solid var(--ink) !important; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 50%;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
.menu-btn { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

/* ---------- Hero ---------- */
.hero { padding: clamp(60px, 11vw, 132px) 0 clamp(40px, 7vw, 76px); }
.hero-inner { max-width: 46rem; }

.tagline {
  margin: 0 0 22px;
  font-size: .68rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted);
}
.hero h1 { margin-bottom: .55em; }
.hero .lead { font-size: 1.06rem; max-width: 40rem; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin: 34px 0; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 22px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: transparent; color: var(--ink);
  font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn:hover { border-color: var(--ink); background: var(--hover); }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { background: transparent; color: var(--ink); }

/* meta rows (formerly colourful chips) */
.chips { display: flex; flex-wrap: wrap; gap: 8px 26px; list-style: none; margin: 0; padding: 0; }
.chips li {
  font-size: .78rem; letter-spacing: .04em; color: var(--muted);
  padding-left: 14px; position: relative;
}
.chips li::before {
  content: "—"; position: absolute; left: 0; color: var(--line-strong);
}

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 7vw, 92px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { margin-bottom: 42px; }
.section-head h2 { margin-bottom: .3em; }
.section-sub { margin: 0; color: var(--muted); font-size: .95rem; }

/* ---------- Grid & cards (hairline blocks, no boxes) ---------- */
.grid { display: grid; gap: 0; border-top: 1px solid var(--line); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  padding: 30px 30px 30px 0;
  border-bottom: 1px solid var(--line);
  background: none;
}
.grid-2 > .card:nth-child(odd),
.grid-3 > .card:nth-child(3n+1) { padding-left: 0; }
.grid-2 > .card:nth-child(even),
.grid-3 > .card:nth-child(3n+2),
.grid-3 > .card:nth-child(3n) { padding-left: 30px; border-left: 1px solid var(--line); }

.card h3 { margin-bottom: .45em; }
.card p:last-child { margin-bottom: 0; }
.card p { font-size: .95rem; }

.card-icon {
  display: none;   /* icons removed for a calmer, typographic look */
}

.project { display: flex; flex-direction: column; }
.project .tags { margin-top: auto; padding-top: 18px; }

.badge {
  align-self: flex-start;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: .64rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted);
}
.badge-done { color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 0; padding: 0; }
.tags li {
  font-family: var(--font-mono);
  font-size: .7rem; letter-spacing: .02em;
  color: var(--muted);
}
.tags li + li::before { content: "· "; color: var(--line-strong); }

.list { margin: 0; padding-left: 1.1em; }
.list li { margin-bottom: .5em; font-size: .95rem; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0 0 46px; padding: 0; border-top: 1px solid var(--line); }
.timeline li {
  display: grid; grid-template-columns: 150px 1fr; gap: 26px;
  padding: 26px 0; border-bottom: 1px solid var(--line);
}
.timeline .time {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding-top: .35em;
}
.timeline h3 { margin-bottom: .25em; }
.timeline p { margin: 0; font-size: .93rem; }

/* ---------- Languages (plain, no colour) ---------- */
.langs { display: grid; gap: 0; border-top: 1px solid var(--line); max-width: 34rem; }
.lang {
  display: flex; justify-content: space-between; align-items: baseline; gap: 20px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.lang .bar { display: none; }
.lang span { color: var(--ink); font-size: .95rem; }
.lang em { font-style: normal; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ---------- Contact ---------- */
.contact-card {
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  padding: clamp(34px, 5vw, 58px) 0;
  max-width: 44rem;
}
.contact-card h2 { margin-bottom: .4em; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

.contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.contact-item {
  display: block;
  padding: 28px 30px 28px 0;
  border-bottom: 1px solid var(--line);
}
.contact-grid > .contact-item:nth-child(even) { padding-left: 30px; border-left: 1px solid var(--line); }
.contact-item h3 { font-size: .72rem; font-family: var(--font-sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: .7em; }
.contact-item p { margin: 0 0 .3em; font-size: .95rem; }
.contact-item a { border-bottom-color: var(--line-strong); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 34px 0; margin-top: 20px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px 30px; justify-content: space-between; align-items: center; }
.footer-inner p { margin: 0; font-size: .8rem; color: var(--muted); letter-spacing: .02em; }
.footer-nav { display: flex; gap: 22px; }
.footer-nav a {
  border: 0; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.footer-nav a:hover { color: var(--ink); }
.social-links { display: flex; gap: 14px; }
.social-links a { border: 0; color: var(--muted); }
.social-links a:hover { color: var(--ink); }
.social-links svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Reveal (fade only, JS-gated so no-JS users see content) ---------- */
html.js .reveal { opacity: 0; transition: opacity .7s var(--ease); }
html.js .reveal.is-visible { opacity: 1; }
html.js .timeline li.reveal,
html.js .grid .reveal { transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 > .card:nth-child(n) { padding-left: 0; border-left: 0; }
  .grid-3 > .card:nth-child(even) { padding-left: 26px; border-left: 1px solid var(--line); }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  body::before { background-size: 135vw auto; background-position: center 40%; }

  .menu-btn { display: grid; }

  .nav {
    position: fixed; inset: 72px 0 auto 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    padding: 8px 26px 24px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line);
    transform: translateY(-120%);
    transition: transform .3s var(--ease);
  }
  .nav.is-open { transform: translateY(0); }
  .nav a { padding: 15px 0; font-size: .8rem; width: 100%; border-bottom: 1px solid var(--line); }
  .nav a::after { display: none; }

  .grid-2, .grid-3, .contact-grid { grid-template-columns: 1fr; }
  .grid-2 > .card:nth-child(n),
  .grid-3 > .card:nth-child(n),
  .contact-grid > .contact-item:nth-child(n) { padding-left: 0; border-left: 0; }

  .timeline li { grid-template-columns: 1fr; gap: 6px; }
  .timeline .time { padding-top: 0; }

  .footer-inner { flex-direction: column; align-items: flex-start; gap: 20px; }
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.js .reveal { opacity: 1; }
}

@media print {
  .site-header, .hero-cta, .contact-actions, .social-links { display: none; }
  body { background: #fff; color: #000; }
  .card, .timeline li, .lang { break-inside: avoid; }
}
