/* =============================================================
   EHEELAB — main stylesheet
   - Mobile first: base styles are for phones; wider screens are
     adjusted with @media rules near the end of each section.
   - Two themes: light (default) and dark ([data-theme="dark"]).
   - Two languages: English (ltr) and Dhivehi ([lang="dv"], rtl).
     Spacing uses "inline-start / inline-end" so layouts flip
     automatically for right-to-left Dhivehi.
   ============================================================= */


/* ===== 0. Dhivehi fonts (self-hosted) =====
   Files in the /fonts folder (web format, .woff2):
     fonts/faruma.woff2     → Faruma (body text)
     fonts/mv-waheed.woff2  → MV Waheed (headings)
   "unicode-range" makes these fonts handle Thaana letters only,
   so any English inside Dhivehi text stays in Google Sans Flex. */
@font-face {
  font-family: "EL Faruma";
  src: local("Faruma"),
       url("../fonts/faruma.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0780-07BF, U+060C, U+061B, U+061F, U+FDF2, U+FDFD;
}
@font-face {
  font-family: "EL Waheed";
  src: local("MV Waheed"), local("MVWaheed"),
       url("../fonts/mv-waheed.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0780-07BF, U+060C, U+061B, U+061F, U+FDF2, U+FDFD;
}


/* ===== 1. Colours, fonts and sizes =====
   Change a colour here and it changes across the whole site. */

/* --- Light theme: lagoon by day --- */
:root {
  --bg:           #FAF9F6;  /* page background (sand) */
  --surface:      #FFFFFF;  /* cards, panels */
  --surface-2:    #F3F7F6;  /* soft panels (steps) */
  --text:         #0F2A33;  /* main text (deep sea) */
  --muted:        #4D6870;  /* softer text */
  --line:         #E3ECEC;  /* borders */
  --accent:       #0E8F9B;  /* lagoon: buttons, links */
  --accent-hover: #0A6F79;
  --accent-soft:  #E4F5F6;  /* light lagoon backgrounds */
  --on-accent:    #FFFFFF;  /* text on lagoon buttons */
  --glow-1:       #7FD6DC;  /* hero glows */
  --glow-2:       #BFE9F0;
  --glow-opacity: .55;
  --badge-text:   #B4533E;  /* coral badge */
  --badge-bg:     #FDEDE8;
  --header-bg:    rgba(250, 249, 246, .82);
  --cta-from:     #E4F5F6;
  --cta-to:       #FFF4F0;
  --shadow:       0 1px 2px rgba(15, 42, 51, .04), 0 6px 20px rgba(15, 42, 51, .06);

  /* Fonts: Latin letters use Google Sans Flex; Thaana letters
     automatically fall through to Noto Sans Thaana. */
  --font-main:    "Google Sans Flex", "EL Faruma", "Noto Sans Thaana", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-dv:      "EL Faruma", "Google Sans Flex", "Noto Sans Thaana", sans-serif;
  --font-dv-head: "EL Waheed", "EL Faruma", "Google Sans Flex", "Noto Sans Thaana", sans-serif;
  --font-code: "Google Sans Code", ui-monospace, Consolas, monospace;

  /* Shape and spacing */
  --radius:    14px;
  --radius-lg: 22px;
  --container: 1120px;

  color-scheme: light;
}

/* --- Dark theme: ocean at night --- */
[data-theme="dark"] {
  --bg:           #081419;
  --surface:      #0F2128;
  --surface-2:    #0C1B21;
  --text:         #E4F0F1;
  --muted:        #93ADB3;
  --line:         #1B323A;
  --accent:       #3CC4CF;
  --accent-hover: #6DD7DF;
  --accent-soft:  #11313A;
  --on-accent:    #04252A;
  --glow-1:       #0E7C87;
  --glow-2:       #134E66;
  --glow-opacity: .45;
  --badge-text:   #F5A893;
  --badge-bg:     #3A2420;
  --header-bg:    rgba(8, 20, 25, .78);
  --cta-from:     #0F2E36;
  --cta-to:       #1E1E26;
  --shadow:       0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);

  color-scheme: dark;
}


/* ===== 2. Basic reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, p, ol, blockquote { margin: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }


/* ===== 3. Text ===== */
body {
  font-family: var(--font-main);
  font-size: 1.0625rem;          /* about 17px: easy to read on phones */
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.02em;       /* slightly tighter, like the labnol title */
  line-height: 1.15;
}
h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }

p + p { margin-top: 1em; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

code, pre { font-family: var(--font-code); }

.thaana { font-family: var(--font-dv); }

/* Keyboard focus outline (helps people who don't use a mouse) */
:focus-visible { outline: 3px solid var(--glow-1); outline-offset: 3px; border-radius: 6px; }


/* ===== 4. Language switch =====
   Hide whichever language is not selected. */
html[lang="en"] [data-lang="dv"],
html[lang="dv"] [data-lang="en"] { display: none !important; }

/* Dhivehi reads better a little larger, with more line spacing,
   and without the tight letter-spacing used for English. */
html[lang="dv"] body {
  font-family: var(--font-dv);
  font-size: 1.3rem;               /* Faruma draws small, so text is a bit larger */
  line-height: 2;
}
html[lang="dv"] h1,
html[lang="dv"] h2,
html[lang="dv"] h3 {
  font-family: var(--font-dv-head);   /* MV Waheed */
  font-weight: 400;                   /* MV Waheed is already bold; don't thicken it */
  letter-spacing: 0;
  line-height: 1.6;
}
html[lang="dv"] h2 { font-size: clamp(1.8rem, 4.5vw, 2.4rem); }
html[lang="dv"] h3 { font-size: 1.3rem; }
/* Keep the Latin logo and email in the English font */
html[lang="dv"] .logo,
html[lang="dv"] .hero-title,
html[lang="dv"] [dir="ltr"] { font-family: var(--font-main); }


/* ===== 5. Layout helpers ===== */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 56px 0; }
.section-sub { color: var(--muted); margin-top: 8px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.link-arrow { font-weight: 500; text-decoration: none; white-space: nowrap; }


/* ===== 6. Logo (two weights: bold "Ehee" + light "lab") ===== */
.logo {
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
  line-height: 1;
}
.logo:hover { color: var(--text); }
.logo-ehee { font-weight: 750; }
.logo-lab  { font-weight: 300; color: var(--accent); }
.logo-small { font-size: 1.25rem; }


/* ===== 7. Header, menu and switches ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: background-color .3s, border-color .3s;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
}
.header-inner .logo { margin-inline-end: auto; }

.header-actions { display: flex; align-items: center; gap: 8px; }

/* Two-part switches (language and theme).
   The side that matches the current setting is filled in lagoon. */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: background-color .3s, border-color .3s;
}
.seg button {
  display: grid;
  place-items: center;
  height: 32px;
  min-width: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-main);
  font-size: .85rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.seg button:hover { color: var(--text); }
.seg button[lang="dv"] { font-family: var(--font-dv); font-size: 1.15rem; font-weight: 400; }

/* Highlight the active side */
html[lang="en"] [data-set-lang="en"],
html[lang="dv"] [data-set-lang="dv"],
[data-theme="light"] [data-set-theme="light"],
[data-theme="dark"]  [data-set-theme="dark"] {
  background: var(--accent);
  color: var(--on-accent);
}

/* Icon-only switch (sun / moon) */
.seg-icons button { width: 32px; min-width: 0; padding: 0; }
.seg-icons svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Phone menu button (three lines) */
.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: 0;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
/* Turn the three lines into an X when the menu is open */
.menu-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Phone menu: hidden until the button is tapped */
.site-nav {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  flex-direction: column;
  padding: 8px 20px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.menu-open .site-nav { display: flex; }
.site-nav a {
  padding: 12px 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.site-nav a:last-child { border-bottom: 0; }
.site-nav a:hover { color: var(--accent); }

/* Wider screens: menu in a row, hide the three-line button */
@media (min-width: 760px) {
  .menu-toggle { display: none; }
  .site-nav {
    display: flex;
    position: static;
    flex-direction: row;
    gap: 28px;
    padding: 0;
    margin-inline-end: 12px;
    background: none;
    border: 0;
  }
  .site-nav a { padding: 0; font-size: 1rem; border: 0; }
  html[lang="dv"] .site-nav a { font-size: 1.2rem; }
}


/* ===== 8. Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;               /* big enough to tap on phones */
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { border: 1.5px solid var(--line); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }


/* ===== 9. Hero ===== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 56px 0 64px;
}

/* Soft blurred colour circles behind the hero */
.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: var(--glow-opacity);
  pointer-events: none;
  transition: background-color .3s, opacity .3s;
}
.glow-1 { width: 380px; height: 380px; background: var(--glow-1); top: -140px; left: -100px; }
.glow-2 { width: 320px; height: 320px; background: var(--glow-2); top: -60px;  right: -120px; }

.hero-inner { position: relative; display: grid; gap: 36px; }

.kicker {
  display: inline-block;
  padding: 4px 14px;
  margin-bottom: 18px;
  font-size: .9rem;
  color: var(--accent-hover);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}
[data-theme="dark"] .kicker { color: var(--accent); }
.kicker .thaana { font-size: 1.2rem; font-weight: 600; line-height: 1; }

.hero-title {
  font-size: clamp(3rem, 12vw, 5.5rem);
  letter-spacing: -0.04em;
  line-height: 1;
}
/* In Dhivehi mode, line the Latin logo up on the right */
html[lang="dv"] .hero-title { text-align: right; }

.hero-lead {
  max-width: 34ch;
  margin-top: 18px;
  font-size: clamp(1.15rem, 3vw, 1.35rem);
  color: var(--muted);
}
html[lang="dv"] .hero-lead { max-width: 36ch; font-size: clamp(1.25rem, 3vw, 1.45rem); }

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-quote {
  padding-inline-start: 20px;
  border-inline-start: 2px solid var(--line);
  font-size: 1.15rem;
  line-height: 1.55;
  font-weight: 350;
}
html[lang="dv"] .hero-quote { line-height: 1.9; font-weight: 400; }
.hero-quote footer { margin-top: 12px; font-size: .95rem; color: var(--muted); }

/* Gentle wave line under the hero */
.hero-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  width: 100%;
  height: 24px;
}
.hero-wave path {
  fill: none;
  stroke: var(--glow-1);
  stroke-width: 1.5;
  opacity: .6;
  vector-effect: non-scaling-stroke;
}

@media (min-width: 900px) {
  .hero { padding: 96px 0 88px; }
  .hero-inner { grid-template-columns: 1.4fr 1fr; align-items: end; gap: 64px; }
  .hero-quote { padding-inline-start: 32px; }
}


/* ===== 10. Intro (about me) ===== */
.intro { padding-top: 32px; }
.intro-inner {
  display: grid;
  gap: 20px;
  max-width: 760px;
  color: var(--muted);
}
.intro-inner a { font-weight: 500; }

.avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 1.2rem;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

@media (min-width: 640px) {
  .intro-inner { grid-template-columns: 64px 1fr; gap: 24px; }
}


/* ===== 11. Tool cards ===== */
.card-grid { display: grid; gap: 16px; }
@media (min-width: 640px)  { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .card-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }

.tool-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s, background-color .3s;
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--accent); }

.tool-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.tool-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-card p { margin-top: 8px; color: var(--muted); font-size: 1rem; flex-grow: 1; }
html[lang="dv"] .tool-card p { font-size: 1.2rem; }

.tool-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
}
.tag {
  padding: 3px 10px;
  font-size: .8rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.badge {
  margin-inline-start: auto;
  padding: 3px 10px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--badge-text);
  background: var(--badge-bg);
  border-radius: 999px;
}
html[lang="dv"] .tag,
html[lang="dv"] .badge { font-size: 1rem; }


/* ===== 12. How it works ===== */
.how {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background-color .3s;
}

.steps {
  display: grid;
  gap: 16px;
  margin-top: 28px;
  padding: 0;
  list-style: none;
}
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 24px; } }

.steps li {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.step-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-main);
  font-weight: 600;
}
.steps p { margin-top: 6px; color: var(--muted); font-size: 1rem; }
html[lang="dv"] .steps p { font-size: 1.2rem; }


/* ===== 13. Call to action ===== */
.cta-box {
  padding: 40px 24px;
  text-align: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--cta-from), var(--cta-to));
  border: 1px solid var(--line);
}
.cta-box p { max-width: 46ch; margin: 12px auto 24px; color: var(--muted); }


/* ===== 14. Footer ===== */
.site-footer {
  padding: 40px 0;
  border-top: 1px solid var(--line);
}
.footer-inner {
  display: grid;
  gap: 16px;
  justify-items: start;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-nav a { color: var(--muted); text-decoration: none; }
.footer-nav a:hover { color: var(--accent); }
.footer-note { font-size: .9rem; color: var(--muted); }

@media (min-width: 760px) {
  .footer-inner { grid-template-columns: auto 1fr auto; align-items: center; gap: 32px; }
}


/* ===== 15. Respect "reduce motion" settings ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
