/*
  Dyoptyka website styles
  ========================================
  Quick editing guide:
  - Brand colours and font choices are in :root below.
  - Page layout/navigation styles come first.
  - Each page section is clearly labelled (HOME, TECHNOLOGY, etc.)
  - Shared components (cards, buttons, typography) follow the page sections.
  - Responsive rules sit at the very bottom.
*/


/* ─────────────────────────────────────────
   DESIGN TOKENS — edit colours, fonts, etc.
   ───────────────────────────────────────── */
:root {
  --bg:           #1a2e1a;
  --bg2:          #1f361f;
  --bg3:          #223a22;
  --surface:      #28452a;
  --border:       rgba(120,180,80,0.16);
  --border-bright:rgba(140,210,90,0.28);
  --accent:       #5abf00;
  --accent-light: #7ed420;
  --accent2:      #4a8c2a;
  --accent-dim:   rgba(90,191,0,0.12);
  --text:         #e6f0d8;
  --text-muted:   #7a9e62;
  --text-dim:     #3d6030;
  --green:        #7ed420;
  --radius:       4px;
  --mono:         'DM Mono', monospace;
  --head:         'Syne', sans-serif;
  --body:         'DM Sans', sans-serif;
  --nav-h:        72px;
  --grid:         linear-gradient(rgba(90,191,0,0.09) 1px, transparent 1px),
                  linear-gradient(90deg, rgba(90,191,0,0.09) 1px, transparent 1px);
}


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

html {
  font-size: 18px;
  /* Prevent Android/iOS from inflating font sizes */
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-weight: 300;
  line-height: 1.7;
  overflow: hidden;
  height: 100vh;
  height: 100dvh; /* dvh = dynamic viewport height, correct on Android Chrome */
}

/* Full-screen shell that sits below the nav.
   Pages are absolutely positioned inside this so Android
   can scroll them — Android Chrome often refuses to scroll
   children of position:fixed elements. */
#page-shell {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0; bottom: 0;
  overflow: hidden; /* shell itself does not scroll */
}

/* Global noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("../images/noise.png");
  opacity: 0.35;
}


/* ─────────────────────────────────────────
   NAVIGATION
   ───────────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(1.5rem, 5vw, 4rem);
  height: var(--nav-h);
  background: rgba(22, 42, 22, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  height: var(--nav-h);
  flex-shrink: 0;
  padding: 10px 0;
}
.nav-logo img {
  height: 50px;
  width: auto;
  display: block;
  transition: filter 0.2s;
}
.nav-logo:hover img {
  filter: brightness(1.1) drop-shadow(0 0 6px rgba(90,191,0,0.4));
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0 auto;
}
.nav-links a {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
  cursor: pointer;
}
.nav-links a:hover  { color: var(--accent); background: var(--accent-dim); }
.nav-links a.active { color: var(--accent); background: var(--accent-dim); }

/* Hamburger button — hidden on desktop, shown on mobile */
.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  /* 44px minimum tap target recommended for Android */
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  background: none;
  border: none;
  justify-content: center;
  align-items: center;
}
.nav-burger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text);
  transition: all 0.3s;
}


/* ─────────────────────────────────────────
   PAGE SYSTEM
   Each <section class="page"> fills the full
   area below the nav bar and scrolls on its
   own. Using overflow-y: scroll (not auto)
   because some Android browsers won't enable
   touch-scrolling on "auto" elements.
   ───────────────────────────────────────── */
.page {
  /* Absolute inside #page-shell — Android Chrome scrolls these reliably,
     whereas scrolling inside position:fixed children is often broken. */
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;  /* momentum scroll on iOS/older Android */
  overscroll-behavior-y: contain;    /* prevent pull-to-refresh fighting scroll */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  background-image: var(--grid);
  background-size: 60px 60px;
}

/* Soft radial glow behind each page */
.page::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse 70% 60% at 50% 40%,
    rgba(126,200,50,0.07) 0%,
    transparent 70%
  );
  animation: pulse 8s ease-in-out infinite;
}

.page.active {
  opacity: 1;
  pointer-events: auto;
}

/* Consistent inner padding for all pages */
.page-inner {
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.5rem, 5vw, 4rem) clamp(3rem, 6vw, 5rem);
  position: relative;
  z-index: 1;
}


/* ─────────────────────────────────────────
   HOME PAGE
   ───────────────────────────────────────── */
#page-home {
  background-color: var(--bg);
}

/* Green accent stripe at the top of the home page */
#page-home::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent) 30%,
    var(--accent-light) 60%,
    transparent
  );
  z-index: 2;
}

/* Ambient glow behind hero text */
.hero-glow {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(
    ellipse,
    rgba(90,191,0,0.13) 0%,
    rgba(74,140,42,0.08) 40%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
  animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1;   transform: translateX(-50%) scale(1);   }
  50%       { opacity: 0.6; transform: translateX(-50%) scale(1.1); }
}

/* Large display heading */
.hero-title {
  font-family: var(--head);
  font-weight: 800;
  font-size: clamp(2.8rem, 8vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--text);
  position: relative;
  z-index: 1;
  margin-bottom: 2rem;
}
.hero-title em {
  font-style: normal;
  color: transparent;
  -webkit-text-stroke: 1px rgba(90,191,0,0.55);
}

/* Home body row: image card on the left, text on the right.
   On narrow screens the row becomes a column (see responsive). */
.home-body-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Image card — fixed width on desktop */
.home-body-row .compare-item {
  flex: 0 0 220px;
  width: 220px;
}

/* Description text — fills remaining space */
.home-body-row .hero-desc {
  flex: 1;
  margin-bottom: 0;
  min-width: 0; /* prevents flex children overflowing */
}

.hero-desc {
  max-width: 780px;
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1.75;
  position: relative;
  z-index: 1;
  margin-bottom: 3rem;
}


/* ─────────────────────────────────────────
   DM IMAGE — HOVER / TAP SWAP
   Shows DM Active by default.
   Hovering (desktop) or tapping (mobile)
   swaps to the DM Inactive image.
   To change images: replace
     assets/images/dm-active.png
     assets/images/dm-inactive.png
   ───────────────────────────────────────── */
.compare-hover {
  position: relative;
  cursor: pointer;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.compare-hover .img-active,
.compare-hover .img-inactive {
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

/* Active (default): visible */
.compare-hover .img-active {
  opacity: 1;
  display: block;
}

/* Inactive: overlaid, hidden by default */
.compare-hover .img-inactive {
  opacity: 0;
  position: absolute;
  top: 0; left: 0;
  height: 100%;
}

/* Label visibility */
.compare-hover .img-active-label   { display: inline; }
.compare-hover .img-inactive-label { display: none; }

/* Desktop: hover triggers swap */
.compare-hover:hover .img-active         { opacity: 0; }
.compare-hover:hover .img-inactive       { opacity: 1; }
.compare-hover:hover .img-active-label   { display: none; }
.compare-hover:hover .img-inactive-label { display: inline; }

/* Mobile: tap triggers swap (class toggled by JS in main.js) */
.compare-hover.is-tapped .img-active         { opacity: 0; }
.compare-hover.is-tapped .img-inactive       { opacity: 1; }
.compare-hover.is-tapped .img-active-label   { display: none; }
.compare-hover.is-tapped .img-inactive-label { display: inline; }

/* Label bar at the bottom of the image card */
.compare-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.75rem 1rem;
  background: linear-gradient(to top, rgba(22,42,22,0.95), transparent);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}
.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  font-size: 0.6rem;
}
.badge-on,
.badge-off {
  background: rgba(90,191,0,0.15);
  color: var(--accent);
  border: 1px solid rgba(90,191,0,0.35);
}


/* ─────────────────────────────────────────
   TECHNOLOGY PAGE
   ───────────────────────────────────────── */
#page-technology { background-color: #1e331e; }

.tech-constrain {
  width: max-content;
  max-width: 100%;
}
.tech-constrain .advantage-list { width: 100%; }

.tech-body {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.85;
}
.tech-body p + p { margin-top: 1rem; }

.advantage-list {
  list-style: none;
  margin-top: 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.advantage-list li {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: border-color 0.2s, background 0.2s;
}
.advantage-list li:hover {
  border-color: rgba(0,212,255,0.3);
  background: var(--accent-dim);
}
.advantage-list li::before { content: '✓'; color: var(--green); font-size: 0.7rem; }


/* ─────────────────────────────────────────
   EVALUATION PAGE
   ───────────────────────────────────────── */
#page-evaluation { background-color: #1e331e; }

.eval-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: 3rem;
  max-width: 1100px;
}

.eval-card {
  padding: 2rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
.eval-card:hover { border-color: rgba(0,212,255,0.25); }

.eval-icon { width: 48px; height: 48px; margin-bottom: 1.25rem; color: var(--accent); }
.eval-icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.eval-title { font-family: var(--head); font-weight: 600; font-size: 1.1rem; margin-bottom: 0.75rem; }
.eval-body  { font-size: 0.9rem; color: var(--text-muted); line-height: 1.75; }


/* ─────────────────────────────────────────
   FAQS PAGE
   ───────────────────────────────────────── */
#page-faqs { background-color: #1e331e; }


/* ─────────────────────────────────────────
   PUBLICATIONS PAGE
   ───────────────────────────────────────── */
#page-publications { background-color: #1e331e; }

.pub-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 4rem;
}
.pub-cat-btn {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.4rem 0.9rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 36px; /* larger tap target on Android */
}
.pub-cat-btn:hover,
.pub-cat-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.pub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}
.pub-card { background: var(--surface); padding: 1.5rem; border: 1px solid var(--border); }

.pub-cat-label { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent-light); margin-bottom: 0.75rem; }
.pub-title  { font-family: var(--head); font-weight: 600; font-size: 0.9rem; line-height: 1.4; color: var(--text); margin-bottom: 0.5rem; }
.pub-venue  { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 1rem; }
.pub-links  { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pub-link   { font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); text-decoration: none; padding: 0.25rem 0.6rem; border: 1px solid rgba(0,212,255,0.25); border-radius: 2px; transition: all 0.2s; }
.pub-link:hover { background: var(--accent-dim); border-color: var(--accent); }

.pub-award {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: #f0c040; background: rgba(240,192,64,0.1); border: 1px solid rgba(240,192,64,0.25);
  border-radius: 2px; padding: 0.2rem 0.5rem; margin-bottom: 0.6rem;
}


/* ─────────────────────────────────────────
   REFERENCES PAGE
   ───────────────────────────────────────── */
#page-references { background-color: #1e331e; }

.reference-card {
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 1.5rem 2rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 2rem;
}
.reference-card p  { font-size: 0.9rem; color: var(--text-muted); line-height: 1.75; }
.reference-card a  { color: var(--accent); text-decoration: none; }
.reference-card a:hover { text-decoration: underline; }


/* ─────────────────────────────────────────
   CONTACT PAGE
   ───────────────────────────────────────── */
#page-contact { background-color: #1e331e; }

.contact-inner  { max-width: 600px; }
.contact-card   { margin-top: 2.5rem; padding: 2.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.contact-name   { font-family: var(--head); font-weight: 700; font-size: 1.3rem; margin-bottom: 0.25rem; }
.contact-role   { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 1.5rem; }
.contact-detail { font-size: 0.9rem; color: var(--text); display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.75rem; line-height: 1.6; }
.contact-detail-label { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); min-width: 80px; padding-top: 1px; }
.contact-email  { font-family: var(--mono); color: var(--accent); letter-spacing: 0.03em; }


/* ─────────────────────────────────────────
   SHARED COMPONENTS
   ───────────────────────────────────────── */

/* Section labels */
.section-eyebrow {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.section-eyebrow::before { content: ''; width: 20px; height: 1px; background: var(--accent); }

.section-title {
  font-family: var(--head);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.1em;
  text-transform: uppercase; text-decoration: none;
  padding: 0.8rem 1.5rem; border-radius: var(--radius);
  transition: all 0.25s; cursor: pointer; border: none;
}
.btn-primary { background: var(--accent); color: var(--bg); font-weight: 500; }
.btn-primary:hover { background: var(--accent-light); box-shadow: 0 0 30px rgba(90,191,0,0.4); }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border-bright); }
.btn-outline:hover { color: var(--text); border-color: var(--accent); background: var(--accent-dim); }

/* Footer inside each page section */
.page-footer {
  padding: 1.5rem clamp(1.5rem, 5vw, 4rem);
  background-color: var(--bg2);
  background-image: var(--grid);
  background-size: 60px 60px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end;
  flex-wrap: wrap; gap: 1rem;
}
.page-footer p { font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.1em; color: var(--text-dim); }

/* Reveal animation — JS adds .visible when section is shown */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* Scrollbar styling */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--surface); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

::selection { background: rgba(90,191,0,0.2); color: var(--text); }


/* ─────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
   768px  — hamburger nav
   700px  — eval/faq single column
   600px  — home row stacks vertically
   480px  — single-column advantage list
   ───────────────────────────────────────── */

@media (max-width: 768px) {
  /* Show hamburger, hide inline links */
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: rgba(22,42,22,0.97);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem 2rem; gap: 0.5rem; z-index: 99;
  }
  .nav-links.open a { font-size: 0.85rem; padding: 0.6rem 0.75rem; }
  .nav-burger { display: flex; }
}

@media (max-width: 700px) {
  /* Evaluation and FAQ cards go single-column */
  .eval-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  /* Home page: image and text stack vertically */
  .home-body-row {
    flex-direction: column;
    align-items: stretch;
  }
  /* Image card fills full width, capped so it doesn't get too wide on tablets */
  .home-body-row .compare-item {
    flex: none;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  /* Advantage list single-column */
  .advantage-list { grid-template-columns: 1fr; }
}
