/* gandalfur.com — warm off-white, serif, like a well-made book
   Color variables live in theme.css (light + dark modes) */

@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

:root {
  --color-available: #3a6b47;
  --color-soon-bg:   #EDEBE6;
  --color-soon-text: #7a7870;
}

/* ── Hero ────────────────────────────────────────────────── */

.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--sp-24) var(--sp-8) var(--sp-16);
  text-align: center;
}

.hero h1 {
  font-size: clamp(var(--text-xl), 3.5vw, var(--text-3xl));
  font-weight: normal;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-6);
  color: var(--color-text);
}

.hero p {
  font-size: var(--text-lg);
  color: var(--color-secondary);
  line-height: 1.7;
  max-width: calc(60ch - 30px);
  margin-left: auto;
  margin-right: auto;
}

.hero p + p {
  margin-top: var(--sp-4);
}

/* ── Apps section ────────────────────────────────────────── */

.apps-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--sp-8) var(--sp-24);
}

.domain-group {
  margin-bottom: var(--sp-16);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}

.apps-grid--featured {
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

.apps-grid--featured:has(:last-child:nth-child(2)) {
  grid-template-columns: repeat(2, 1fr);
  max-width: 740px;
  margin: 0 auto;
}

/* ── App cards ───────────────────────────────────────────── */

.app-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--sp-6);
  background: var(--color-bg);
  border: 1px solid var(--color-ornament);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  position: relative;
  isolation: isolate;
  transition: transform 200ms ease,
              box-shadow 200ms ease;
}

/* Traveling light sweep — conic gradient masked to border ring only */
.app-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-md) + 1px);
  padding: 2px;
  background: conic-gradient(
    from var(--border-angle),
    transparent 0deg,
    transparent 140deg,
    rgba(181, 164, 122, 0.06) 190deg,
    rgba(181, 164, 122, 0.30) 250deg,
    rgba(240, 212, 120, 0.65) 295deg,
    rgba(181, 164, 122, 0.30) 335deg,
    rgba(181, 164, 122, 0.06) 358deg,
    transparent 360deg
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
  z-index: 1;
}

.app-card--featured {
  padding: var(--sp-8);
  background: var(--color-surface);
}

a.app-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 0 0 1px var(--color-ornament),
    0 8px 24px rgba(0, 0, 0, 0.1),
    0 2px 8px rgba(181, 164, 122, 0.15);
}

a.app-card:hover::before {
  opacity: 1;
  padding: 4px;
  animation: border-sweep 7s linear infinite;
}

@keyframes border-sweep {
  from { --border-angle: 0deg; }
  to   { --border-angle: 360deg; }
}

.app-icon {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  margin-bottom: var(--sp-4);
  display: block;
}

.app-card-body {
  flex: 1;
}

.app-card h3 {
  font-size: var(--text-base);
  font-weight: normal;
  margin-bottom: var(--sp-2);
  letter-spacing: -0.01em;
}

.app-card--featured h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--sp-3);
}

.app-tagline {
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-secondary);
  line-height: 1.65;
  max-width: none;
}

.app-card-meta {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  flex-wrap: wrap;
}

/* ── Badges ──────────────────────────────────────────────── */

.badge {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.badge--ios {
  background: var(--color-surface);
  color: var(--color-secondary);
  border: 1px solid var(--color-border);
}

.badge--available {
  background: #e8f2ec;
  color: var(--color-available);
}

.badge--soon {
  background: var(--color-soon-bg);
  color: var(--color-soon-text);
}

/* ── About ───────────────────────────────────────────────── */

.about-section {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--sp-16) var(--sp-8) var(--sp-24);
  border-top: 1px solid var(--color-ornament);
}

.about-section h2 {
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--sp-8);
}

.about-section p {
  font-size: var(--text-base);
  color: var(--color-secondary);
  line-height: 1.8;
  margin-bottom: var(--sp-6);
}

.about-section a {
  color: var(--color-text);
  text-underline-offset: 3px;
}

/* ── Support — golden divider ───────────────────────── */

.support-page {
  border-top-color: var(--color-ornament);
}

/* ── Responsive ──────────────────────────────────────────── */

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

@media (max-width: 560px) {
  .hero {
    padding: var(--sp-16) var(--sp-4) var(--sp-12);
  }

  .apps-section {
    padding: 0 var(--sp-4) var(--sp-16);
  }

  .apps-grid,
  .apps-grid--featured {
    grid-template-columns: 1fr;
  }

  .about-section {
    padding: var(--sp-12) var(--sp-4) var(--sp-16);
  }
}
