@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Literata:opsz,wght@7..72,600;7..72,700&display=swap");

:root {
  color-scheme: light;
  --page: #f4f0e8;
  --surface: #fcfaf6;
  --text: #182027;
  --muted: #59636c;
  --border: #d7d0c3;
  --accent: #a9470d;
  --accent-hover: #873708;
  --accent-soft: #f3e2d3;
  --teal: #1e5b63;
  --teal-hover: #17474d;
  --teal-soft: #ddeae8;
  --focus: #1674a5;
  --backdrop: rgb(17 20 23 / .56);
  --heading: "Literata", Georgia, serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: .45rem;
  --max: 76rem;
  --reading: 72ch;
  --header-height: 4.25rem;
  --brand-mark: url("images/kooshky-mark-light.png");
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #111417;
  --surface: #181d21;
  --text: #ece7dd;
  --muted: #adb4b8;
  --border: #30383e;
  --accent: #f28c45;
  --accent-hover: #ffa563;
  --accent-soft: #332219;
  --teal: #70b7b4;
  --teal-hover: #91d1ce;
  --teal-soft: #193033;
  --focus: #77c8ff;
  --backdrop: rgb(0 0 0 / .7);
  --brand-mark: url("images/kooshky-mark-dark.png");
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}
body.menu-open { overflow: hidden; }
a { color: var(--teal); text-underline-offset: .18em; overflow-wrap: anywhere; }
a:hover { color: var(--accent); }
button, input { font: inherit; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
::selection { background: var(--accent-soft); }

.skip-link {
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 500;
  transform: translateY(-160%);
  padding: .7rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}
.skip-link:focus { transform: none; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--page) 94%, transparent);
  backdrop-filter: blur(12px);
}
.header-inner {
  width: min(calc(100% - 2rem), var(--max));
  min-height: var(--header-height);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-logo {
  flex: 0 0 auto;
  width: 2.6rem;
  aspect-ratio: 1;
  background: var(--brand-mark) center / contain no-repeat;
}
.brand strong { display: block; font-family: var(--heading); font-size: .98rem; line-height: 1.2; }
.brand small { display: block; color: var(--accent); font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.desktop-nav { display: flex; align-items: center; gap: .2rem; }
.desktop-nav a,
.mobile-nav a {
  padding: .55rem .7rem;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
}
.desktop-nav a[aria-current="page"],
.desktop-nav a:hover,
.mobile-nav a[aria-current="page"],
.mobile-nav a:hover {
  background: var(--teal-soft);
  color: var(--teal);
}
.header-actions { display: flex; align-items: center; gap: .45rem; }
.plain-button {
  min-height: 2.6rem;
  padding: .5rem .72rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.plain-button:hover { border-color: var(--teal); color: var(--text); }
.menu-button { display: none; }

.nav-backdrop {
  position: fixed;
  inset: var(--header-height) 0 0;
  z-index: 180;
  background: var(--backdrop);
}
.mobile-nav {
  position: fixed;
  top: var(--header-height);
  right: 0;
  z-index: 190;
  width: min(20rem, calc(100% - 2rem));
  padding: 1rem;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.mobile-nav a { display: block; margin-bottom: .25rem; }

.container { width: min(calc(100% - 2rem), var(--max)); margin-inline: auto; }
.hero { padding: clamp(3.6rem, 8vw, 7rem) 0 clamp(3rem, 6vw, 5rem); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(11rem, 17rem);
  gap: clamp(2rem, 7vw, 6rem);
  align-items: center;
}
.hero-mark {
  width: 100%;
  aspect-ratio: 1;
  background: var(--brand-mark) center / contain no-repeat;
  opacity: .96;
}
.eyebrow {
  margin: 0 0 .55rem;
  color: var(--accent);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
h1, h2, h3 {
  margin-top: 0;
  font-family: var(--heading);
  line-height: 1.14;
  text-wrap: balance;
}
h1 {
  max-width: 15ch;
  margin-bottom: 1.2rem;
  font-size: clamp(2.55rem, 6.2vw, 5.2rem);
  letter-spacing: -.035em;
}
h2 { font-size: clamp(1.7rem, 3vw, 2.5rem); }
h3 { font-size: 1.22rem; }
.hero-copy { max-width: 58ch; margin: 0; color: var(--muted); font-size: clamp(1.02rem, 1.5vw, 1.18rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.65rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.95rem;
  padding: .7rem 1rem;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
}
.button:hover {
  transform: translateY(-1px);
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}
.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.button-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #fff;
}
html[data-theme="dark"] .button-primary,
html[data-theme="dark"] .button-primary:hover { color: #111417; }

.social-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-top: 1.15rem;
}
.social-button {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  min-height: 3.65rem;
  padding: .7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background-color .18s ease;
}
.social-button:hover {
  transform: translateY(-1px);
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--text);
}
.social-button svg { display: block; width: 1.55rem !important; height: 1.55rem !important; max-width: 1.55rem; flex: 0 0 1.55rem; color: var(--teal); }
.social-button strong { display: block; line-height: 1.15; }
.social-button small { display: block; margin-top: .15rem; color: var(--muted); font-size: .76rem; font-weight: 500; }
.social-button-instagram svg { color: var(--accent); }
.dm-line { margin: .9rem 0 0; color: var(--muted); font-size: .92rem; }

.section { padding: clamp(2.8rem, 6vw, 5rem) 0; border-top: 1px solid var(--border); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.6rem; }
.section-heading h2 { margin-bottom: 0; }
.section-heading p { max-width: 42ch; margin: 0; color: var(--muted); }
.section-after { margin: 1.4rem 0 0; }
.article-list { border-top: 1px solid var(--border); }
.article-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .6rem 2rem;
  padding: 1.55rem 0;
  border-bottom: 1px solid var(--border);
}
.article-entry h3 { grid-column: 1; margin: 0; }
.article-entry h3 a { color: var(--text); text-decoration: none; }
.article-entry h3 a:hover { color: var(--accent); }
.article-entry p { grid-column: 1; max-width: 66ch; margin: 0; color: var(--muted); }
.article-meta {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .8rem;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.text-link { grid-column: 2; grid-row: 2 / span 2; align-self: center; font-weight: 700; white-space: nowrap; }
.empty-state { padding: clamp(1.5rem, 4vw, 2.5rem); border-left: 3px solid var(--teal); background: var(--teal-soft); }
.empty-state h3, .empty-state h2 { margin-bottom: .4rem; }
.empty-state p:last-child { margin-bottom: 0; color: var(--muted); }
.empty-state-large { max-width: 48rem; margin: 3rem auto; }

.page-intro { padding: clamp(3.4rem, 8vw, 6rem) 0 2.5rem; }
.page-intro h1 { max-width: 16ch; font-size: clamp(2.4rem, 5vw, 4.6rem); }
.page-intro p { max-width: 58ch; color: var(--muted); font-size: 1.08rem; }
.search-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0 2.4rem;
}
.search-wrap label { min-width: 0; }
.search-wrap input {
  width: 100%;
  min-height: 3.1rem;
  padding: .7rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.search-status { color: var(--muted); font-size: .9rem; }
.content-group { padding: 2.2rem 0 3rem; border-top: 1px solid var(--border); }
.group-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; margin-bottom: 1rem; }
.group-heading h2 { margin-bottom: 0; }
.count { color: var(--muted); font-size: .88rem; font-weight: 700; }
code { padding: .08rem .3rem; border: 1px solid var(--border); border-radius: .25rem; background: var(--surface); }

.about-toolbar { display: flex; justify-content: flex-start; margin: 1.5rem 0 0; }
[data-about-header][dir="rtl"] .container { text-align: right; }
[data-about-header][dir="rtl"] h1,
[data-about-header][dir="rtl"] p { margin-right: 0; margin-left: auto; }
[data-about-header][dir="rtl"] .about-toolbar { direction: rtl; }
.about-photo { margin: 0 0 2.5rem; }
.image-frame {
  display: grid;
  place-items: center;
  min-height: 18rem;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}
.image-frame img { width: 100%; max-height: 42rem; object-fit: contain; }
.image-fallback { width: 100%; padding: 3rem 1.25rem; color: var(--muted); text-align: center; }
.image-fallback strong { display: block; margin-bottom: .4rem; color: var(--text); font-family: var(--heading); }
.image-fallback code { display: inline-block; margin-top: .4rem; }
figcaption { margin-top: .65rem; color: var(--muted); font-size: .86rem; }
.about-copy { max-width: var(--reading); }
.about-copy[dir="rtl"] {
  margin-left: auto;
  margin-right: 0;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 1.04rem;
  line-height: 2;
  text-align: right;
}
.about-copy[dir="rtl"] h2,
.about-copy[dir="rtl"] p { text-align: right; }
.about-block { padding: 1.55rem 0; border-top: 1px solid var(--border); }
.about-block:first-child { border-top: 0; }
.about-block h2 { margin-bottom: .65rem; font-size: 1.5rem; }
.about-block p { margin: .65rem 0; }
.report-section { padding-top: 2rem; }
.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(15rem, .55fr);
  gap: 1rem;
  align-items: start;
  margin: 2rem 0 3rem;
}
.report-card { margin: 0; min-width: 0; }
.report-card .image-frame { min-height: 22rem; }
.report-card.wide .image-frame img { max-height: 34rem; }
.report-card.tall .image-frame img { max-height: 46rem; }

.site-footer {
  padding: 2rem 0 max(2rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .88rem;
}
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-links { display: flex; flex-wrap: wrap; gap: .45rem 1rem; }

@media (max-width: 920px) {
  .desktop-nav { display: none; }
  .menu-button { display: inline-flex; }
}

@media (max-width: 760px) {
  .header-inner { width: min(calc(100% - 1.25rem), var(--max)); }
  .plain-button [data-theme-label] { display: none; }
  .hero { padding-top: 3.4rem; }
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
  .hero-mark { width: min(15rem, 70vw); grid-row: 1; justify-self: center; }
  .hero-grid > div:first-child { grid-row: 2; }
  .section-heading { display: block; }
  .section-heading p { margin-top: .65rem; }
  .article-entry { grid-template-columns: minmax(0, 1fr); }
  .article-entry h3,
  .article-entry p,
  .article-meta,
  .text-link { grid-column: 1; grid-row: auto; }
  .text-link { margin-top: .35rem; }
  .search-wrap { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .report-card .image-frame { min-height: 14rem; }
  .social-button { flex: 1 1 13rem; }
}

@media (max-width: 390px) {
  .brand small { display: none; }
  .brand strong { font-size: .86rem; }
  .brand-logo { width: 2.25rem; }
  .header-actions { gap: .3rem; }
  .plain-button { min-width: 2.55rem; padding-inline: .55rem; }
  h1 { font-size: clamp(2.25rem, 14vw, 3.25rem); }
  .social-button { flex-basis: 100%; }
}

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

/* Apps and homepage Word of the Day */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.page-intro-compact {
  padding-bottom: 1.4rem;
}

.page-intro-compact h1 {
  margin-bottom: .8rem;
}

.apps-library {
  padding-bottom: clamp(3rem, 7vw, 6rem);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.app-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--teal);
  border-radius: var(--radius);
  background: var(--surface);
}

.app-card-icon {
  width: 4.25rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: .7rem;
  background: var(--page);
  overflow: hidden;
}

.app-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-default-logo {
  display: block;
  width: 82%;
  height: 82%;
  background: var(--brand-mark) center / contain no-repeat;
}

.app-card h3 {
  margin-bottom: .55rem;
}

.app-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.app-card h3 a:hover {
  color: var(--accent);
}

.app-card p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.app-card .text-link {
  grid-column: auto;
  grid-row: auto;
  margin-top: auto;
  align-self: flex-start;
}

.home-wotd-section {
  padding: 0 0 clamp(2.5rem, 5vw, 4rem);
}

.home-wotd {
  min-height: 6.25rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .85rem 1.25rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}

.home-wotd-label {
  color: var(--accent);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.home-wotd-date {
  color: var(--muted);
  font-size: .88rem;
  font-weight: 600;
}

.home-wotd-word {
  min-width: 0;
  margin: 0;
  font-family: var(--heading);
  font-size: clamp(1.65rem, 4vw, 2.45rem);
  line-height: 1.1;
}

.home-wotd-word a {
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.home-wotd-word a:hover {
  color: var(--accent);
}

.home-wotd-open {
  color: var(--teal);
  font-weight: 700;
  white-space: nowrap;
}

.home-wotd-loading,
.home-wotd-empty {
  grid-column: 2 / -1;
  color: var(--muted);
}

@media (max-width: 900px) {
  .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

  .home-wotd {
    grid-template-columns: 1fr auto;
  }

  .home-wotd-label {
    grid-column: 1;
  }

  .home-wotd-date {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .home-wotd-word {
    grid-column: 1 / -1;
  }

  .home-wotd-open {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

