/* Codequay — harbour ink, teal water, rope gold. No default purple. */
:root {
  --ink: #10262b;
  --ink-soft: #1c3a40;
  --teal: #1a8a80;
  --teal-deep: #0e5c5a;
  --teal-mid: #147a74;
  --gold: #c9962e;
  --gold-soft: #e8c56a;
  --paper: #f4f1ea;
  --paper-2: #ebe6db;
  --foam: #fffcf7;
  --line: #d9d2c4;
  --text: #1a2426;
  --muted: #5a6466;
  --ok: #0e5c5a;
  --ok-bg: #e5f3f1;
  --err: #8a2f22;
  --err-bg: #f8e8e4;
  --warn-bg: #f7efd8;
  --shadow: 0 12px 32px rgba(16, 38, 43, 0.08);
  --radius: 16px;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", ui-monospace, "Segoe UI Mono", Consolas, Menlo, monospace;
  --header-h: 4.1rem;
  --adsense: 0;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1100px 480px at 8% -12%, rgba(201, 150, 46, 0.16), transparent 58%),
    radial-gradient(900px 420px at 110% 0%, rgba(26, 138, 128, 0.12), transparent 55%),
    var(--paper);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--teal-deep); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.skip {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 0.9rem; border-radius: 8px; z-index: 80;
}
.skip:focus { top: 0.6rem; }
.wrap { width: min(1080px, calc(100% - 1.5rem)); margin-inline: auto; }
.icon { width: 1.15em; height: 1.15em; flex: none; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--paper) 86%, white);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: var(--header-h);
}
.brand {
  display: flex; align-items: center; gap: 0.7rem;
  color: var(--ink); text-decoration: none;
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.4rem; letter-spacing: 0.01em;
}
.brand .logo { width: 40px; height: 40px; border-radius: 10px; }
.nav-toggle {
  display: none; border: 1px solid var(--line); background: var(--paper-2);
  border-radius: 10px; padding: 0.4rem; color: var(--ink);
}
.nav-toggle .icon { width: 22px; height: 22px; }
.site-nav { display: flex; align-items: center; gap: 0.15rem 1.1rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 0.95rem;
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--teal-deep); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.28em; }

/* Main / footer */
main { flex: 1 0 auto; padding: 1.6rem 0 3rem; }
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--ink);
  color: #d7e3e4;
  padding: 1.6rem 0 1.8rem;
  margin-top: auto;
}
.site-footer a { color: var(--gold-soft); }
.site-footer a:hover { color: #fff; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.7rem 1.2rem; margin-bottom: 0.8rem; }
.site-footer p { margin: 0.3rem 0 0; font-size: 0.92rem; color: #b7c6c8; }

/* Hero */
.hero {
  padding: 1.4rem 0 0.4rem;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.15rem);
  line-height: 1.12;
  margin: 0 0 0.7rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 40rem; margin: 0 0 1.2rem; }
.search-bar {
  display: flex; gap: 0.55rem; max-width: 36rem;
  background: var(--foam); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.35rem 0.4rem 0.35rem 1rem;
  box-shadow: var(--shadow);
}
.search-bar input {
  flex: 1; border: 0; background: transparent; font: inherit; min-width: 0;
  color: var(--text);
}
.search-bar input:focus { outline: none; }
.search-bar button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border-radius: 999px; border: 1px solid var(--teal-deep);
  background: var(--teal-deep); color: #fff;
  font: inherit; font-weight: 650; padding: 0.55rem 1.05rem;
  text-decoration: none; cursor: pointer;
}
.search-bar button:hover, .btn:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-ghost {
  background: var(--foam); color: var(--ink); border-color: var(--line);
}
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  font-size: 0.75rem; color: var(--teal-deep); margin: 0 0 0.55rem;
}

/* Grids and cards */
.section { margin-top: 2.4rem; }
.section h2 {
  font-family: var(--font-display);
  font-size: 1.7rem; margin: 0 0 0.9rem; color: var(--ink);
}
.cat-grid, .brand-grid, .card-grid, .howto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.9rem;
}
.card, .cat-card, .brand-card, .howto-card, .code-card {
  background: var(--foam);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem 1.15rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 0.35rem;
}
a.cat-card:hover, a.brand-card:hover, a.howto-card:hover {
  border-color: var(--teal);
  box-shadow: var(--shadow);
}
.cat-card h3, .brand-card h3, .howto-card h3, .code-card h3 {
  font-family: var(--font-display); font-size: 1.2rem; margin: 0; color: var(--ink);
}
.muted, .card p, .cat-card p, .brand-card p, .howto-card p { color: var(--muted); margin: 0; }
.tag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--paper-2); color: var(--ink-soft);
  border-radius: 999px; padding: 0.15rem 0.55rem;
  font-size: 0.78rem; font-weight: 650; width: max-content;
}
.tag-gold { background: #f7efd8; color: #6a4d0d; }

/* Brand page */
.page-head { margin-bottom: 1.2rem; }
.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 0.45rem; color: var(--ink);
}
.reward-box {
  background: var(--ok-bg);
  border: 1px solid color-mix(in srgb, var(--teal) 35%, var(--line));
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex; gap: 0.8rem; align-items: flex-start;
  margin: 1rem 0 1.3rem;
}
.reward-box .icon { width: 1.6rem; height: 1.6rem; color: var(--teal-deep); margin-top: 0.15rem; }
.codes { display: flex; flex-direction: column; gap: 0.8rem; }
.code-card { gap: 0.55rem; }
.code-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  word-break: break-all;
}
.code-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.vote-btn, .copy-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); border-radius: 999px;
  padding: 0.4rem 0.8rem; font: inherit; font-weight: 650; cursor: pointer;
}
.vote-btn[aria-pressed="true"] { background: var(--ok-bg); border-color: var(--teal); color: var(--teal-deep); }
.copy-btn { background: var(--teal-deep); color: #fff; border-color: var(--teal-deep); }
.copy-btn:hover { background: var(--ink); }
.meta-row { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; color: var(--muted); font-size: 0.9rem; }
.empty {
  background: var(--paper-2);
  border-radius: var(--radius);
  padding: 1.2rem 1.15rem;
  color: var(--ink-soft);
}

/* Forms */
form.stack, .stack { display: flex; flex-direction: column; gap: 0.85rem; max-width: 34rem; }
label { font-weight: 650; color: var(--ink-soft); display: flex; flex-direction: column; gap: 0.3rem; }
input[type="text"], input[type="password"], input[type="url"], input[type="search"], select, textarea {
  font: inherit; border: 1px solid var(--line); border-radius: 12px;
  padding: 0.65rem 0.8rem; background: var(--foam); color: var(--text);
  width: 100%;
}
textarea { min-height: 6.5rem; resize: vertical; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.88rem; }
.alert {
  border-radius: 12px; padding: 0.75rem 0.9rem; margin: 0 0 1rem;
}
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-err { background: var(--err-bg); color: var(--err); }
.hidden { display: none !important; }
.article { max-width: 42rem; }
.article h1, .article h2, .article h3 {
  font-family: var(--font-display); color: var(--ink);
}
.article h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); margin: 0 0 0.5rem; }
.article h2 { font-size: 1.4rem; margin: 1.6rem 0 0.5rem; }
.article p, .article li { color: var(--text); }
.updated { color: var(--muted); font-size: 0.92rem; }
.ad-slot { margin: 1.6rem 0; min-height: 0; }
.list-plain { padding-left: 1.15rem; }
.two-col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start;
}
.queue-item { margin-bottom: 0.8rem; }
.queue-item .code-actions { margin-top: 0.4rem; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: var(--header-h);
    background: var(--foam); border-bottom: 1px solid var(--line);
    padding: 0.7rem 1rem 1rem; flex-direction: column; align-items: stretch; gap: 0.2rem;
  }
  .site-header { position: sticky; }
  .site-header.is-open .site-nav { display: flex; }
  .site-nav a { padding: 0.7rem 0.2rem; font-size: 1.05rem; }
  .two-col { grid-template-columns: 1fr; }
  .search-bar { border-radius: 16px; flex-direction: column; padding: 0.55rem; }
  .search-bar button { width: 100%; }
}
