/* Al-kimi — base styles
   ============================================================
   PALETTE (locked)
   Ground:       #F5F1E8
   Ink:          #2C1810
   Burgundy:     #6B1D36   — CTA / primary action
   Gold:         #C9A882   — dark-background accent only (fails AA on ground)
   Deep Indigo:  #2E4057   — secondary action / links / cool counterpoint
   Deep Ochre:   #8B6914   — highlight text on light ground (gold-family,
                              usable where Gold isn't; passes AA but with
                              little margin — prefer 18px+/bold contexts)

   TYPOGRAPHY (locked)
   Display:  Fraunces        — headings, hero lockup
   Body:     Source Serif 4  — paragraph text
   Arabic:   Markazi Text    — every [lang="ar"] element, site-wide
   Mono:     JetBrains Mono  — small technical accents only (figures,
                                dates, footer copyright) — NOT primary body
   ============================================================
   NOTE: the octagram tile (al-kimi-tile.py) runs its own independent
   palette keyed off the ground color. It is intentionally NOT unified
   with the UI palette above — see design-review history.
*/

:root {
  --ground: #F5F1E8;
  --ink: #2C1810;
  --burgundy: #6B1D36;
  --gold: #C9A882;
  --indigo: #2E4057;
  --ochre: #8B6914;
  --rule: rgba(44, 24, 16, 0.15);

  --display: "Fraunces", Georgia, serif;
  --body: "Source Serif 4", Georgia, serif;
  --arabic: "Markazi Text", serif;
  --mono: "JetBrains Mono", "Courier New", monospace;

  /* Spacing scale — 8px base with a 4px half-step. Every padding/margin/
     gap in this file should reference one of these rather than a raw
     px value, so vertical rhythm stays consistent as the site grows. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;
  --space-11: 96px;

  /* Corner radius — square by design, echoing the octagram tile's
     angular geometry rather than defaulting to soft rounded corners. */
  --radius: 0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--ground);
  background-image: url("/images/tile.svg");
  background-repeat: repeat;
  background-size: 144.8528px 144.8528px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
}

/* Arabic — site-wide fix: every [lang="ar"] element now gets Markazi
   Text explicitly, rather than falling back to whatever Arabic font
   the visitor's OS happens to have installed. */
[lang="ar"] {
  font-family: var(--arabic);
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-7) 0 var(--space-11);
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 500;
  margin: 0 0 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

.page-kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--indigo);
  margin: 0 0 var(--space-4);
}

a { color: var(--indigo); transition: color 120ms ease; }
a:hover, a:focus-visible { color: var(--burgundy); }

/* Every top-level content block is its own opaque "card" floating over
   the tile, with a gap between cards so the pattern shows through in
   the space between content — not one continuous solid column. */
main > section {
  background: var(--ground);
  padding: var(--space-7) var(--space-6);
  margin-bottom: var(--space-7);
}

main > section:last-child {
  margin-bottom: 0;
}

/* The hero lockup lives outside the opaque-card system on purpose — a
   plain div (not a section), so it isn't caught by the rule above and
   sits directly on the tile like a mark/logo rather than inside a card. */
.hero-mark {
  padding: 0 var(--space-6);
  margin-bottom: var(--space-7);
}

/* ============================================================
   COMPONENTS
   Buttons: .btn (base) + .btn-primary / .btn-secondary modifiers.
   Every interactive element shares one transition timing and one
   focus-ring treatment so hover/focus feels consistent site-wide.
   ============================================================ */

.btn {
  display: inline-block;
  font-family: var(--body);
  font-weight: 600;
  font-size: 1rem;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  background: var(--burgundy);
  color: var(--ground);
  border-color: var(--burgundy);
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus-visible:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
}

.btn-secondary {
  background: transparent;
  color: var(--indigo);
  border-color: var(--indigo);
}

.btn-secondary:hover:not(:disabled),
.btn-secondary:focus-visible:not(:disabled) {
  background: var(--indigo);
  color: var(--ground);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
}

.site-header-mark {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
}

.site-header-mark [lang="ar"] {
  font-weight: 600;
  font-size: 1.6rem; /* 1.1rem x 1.45 — same ratio as the hero lockup */
}

.site-nav {
  display: flex;
  gap: var(--space-5);
}

.site-nav a {
  color: var(--indigo);
  text-decoration: none;
  font-size: 0.9rem;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--burgundy);
}

/* Hero */

.hero-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 2.75rem;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.hero-title-ar {
  color: var(--burgundy);
  font-weight: 600;
  font-size: 3.625rem; /* 58px — Fraunces stays at 2.75rem/44px */
}

.hero-gloss {
  max-width: 46ch;
  color: var(--ink);
  font-style: italic;
  margin: 0;
}

/* Intro */

.intro {
  max-width: 60ch;
}

.intro p:last-child {
  margin: 0;
}

/* Routing cards */

.routes {
  background: transparent;
  padding: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
}

.route-card {
  display: block;
  padding: var(--space-7) var(--space-6);
  background: var(--ground);
  text-decoration: none;
  color: inherit;
}

.route-card-title {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 500;
  margin: 0 0 var(--space-2);
  color: var(--ink);
  transition: color 120ms ease;
}

.route-card:hover .route-card-title,
.route-card:focus-visible .route-card-title {
  color: var(--burgundy);
}

.route-card-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  max-width: 55ch;
}

/* Prose (Consulting, general markdown content) */

.prose .btn {
  margin: 0 0 var(--space-2);
}

.prose h2 {
  margin-top: 2em;
  border-top: 1px solid var(--rule);
  padding-top: 1em;
}
.prose h2:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

/* Etymology / About */

.etymology-word {
  font-family: var(--display);
  font-weight: 500;
  font-size: 2rem;
  margin: 0 0 var(--space-1);
}

.etymology-pron {
  font-style: italic;
  color: var(--ink);
  margin: 0 0 var(--space-3);
}

.etymology-gloss {
  max-width: 50ch;
  margin: 0 0 var(--space-4);
}

.etymology-origin {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: 0.9rem;
  color: var(--ink);
}

.etymology-origin [lang="ar"] {
  color: var(--burgundy);
  font-size: 1.3rem;
}

.values {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.value-name {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.15rem;
  margin: 0 0 var(--space-1);
}

.value-line {
  margin: 0;
  color: var(--ink);
}

.verse-text {
  margin: 0;
  border-left: 3px solid var(--burgundy);
  padding-left: 20px;
}

.verse-text p {
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.6;
}

.verse-text cite {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--indigo);
  font-style: normal;
}

/* Portfolio */

.portfolio-group-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.3rem;
  margin: 0 0 var(--space-4);
}

.portfolio-group-note {
  font-style: italic;
  color: var(--ink);
  margin: 0 0 var(--space-5);
}

.venture {
  border: 1px solid var(--rule);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.venture:last-child {
  margin-bottom: 0;
}

.venture-name {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0 0 var(--space-1);
}

.venture-description,
.venture-link {
  margin: 0 0 var(--space-1);
  color: var(--ink);
}

.venture-redacted .venture-name {
  display: inline-block;
  background: var(--ink);
  color: transparent;
  user-select: none;
  padding: 0 var(--space-2);
  border-radius: var(--radius);
}

.portfolio-note {
  font-style: italic;
  color: var(--ink);
}

/* Consulting: expertise / good-fit sections */

.expertise-list {
  color: var(--ink);
  line-height: 1.8;
}

.good-fit ul {
  padding-left: 1.2em;
  margin: 0 0 var(--space-4);
}

.good-fit li {
  margin-bottom: 8px;
}

.not-fit {
  color: var(--ink);
  font-size: 0.95rem;
}

/* Contact form */

.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 480px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--ink);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color 120ms ease;
}

.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: var(--indigo);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--indigo);
  outline-offset: 1px;
}

/* Honeypot field — hidden from sighted users via off-screen positioning
   rather than display:none/visibility:hidden, since unsophisticated bots
   often skip fields hidden that way but still fill in off-screen ones. */
.field-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-form button[type="submit"] {
  align-self: flex-start;
}

.form-status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink);
}

/* Footer */

.site-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-6) var(--space-9);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--ground);
}

/* Accessibility */

a:focus-visible,
.route-card:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 2.1rem; }
  .etymology-word { font-size: 1.6rem; }
}
