/* Shared styling for the landing page (index.html) and any non-canvas tool pages
   (e.g. expansion.html) - deliberately separate from style.css, which is specific
   to the triangle explorer (explore.html) and its fixed-viewport canvas layout. */

* {
  box-sizing: border-box;
}

:root {
  /* iOS only reports non-zero safe-area-inset-* once viewport-fit=cover is set on the
     viewport meta tag - see src/style.css / fixIOSViewportBug() in main.js. */
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
}

html, body {
  margin: 0;
  min-height: 100%;
  background: #000000;
  color: #e8e8f0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Stop Android Chrome's "font boosting" auto-inflating font-size on narrow text
     blocks it guesses are the main reading column - KaTeX's absolutely-positioned
     spans (e.g. a \binom fraction) are exactly what that heuristic misfires on. */
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html {
  font-size: 100%; /* explicit root anchor, so nested %/em sizing (KaTeX's own cascade included) has a well-defined base */
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: inherit;
}

.portal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: calc(16px + var(--safe-area-top, 0px)) calc(20px + var(--safe-area-right, 0px)) 16px calc(20px + var(--safe-area-left, 0px));
}

.portal-header h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: #f0c93a;
  letter-spacing: 0.5px;
}

.home-link {
  font-size: 13px;
  line-height: 1.2;
  color: #ffffff;
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #22e8f0;
  background: #171a28;
}

@media (hover: hover) and (pointer: fine) {
  .home-link:hover {
    background: #2a2f47;
    color: #ffffff;
  }
}

.landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: calc(24px + var(--safe-area-top, 0px)) calc(24px + var(--safe-area-right, 0px)) 24px calc(24px + var(--safe-area-left, 0px));
  text-align: center;
}

.landing-footer {
  padding: 16px calc(24px + var(--safe-area-right, 0px)) calc(24px + var(--safe-area-bottom, 0px)) calc(24px + var(--safe-area-left, 0px));
  text-align: center;
  font-size: 16px;
  color: #a9adc1;
}

.landing-footer p {
  margin: 4px 0;
}

.landing-footer a {
  color: #22e8f0;
  text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
  .landing-footer a:hover {
    text-decoration: underline;
  }
}

.landing h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.title-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.3em;
  font-size: clamp(32px, 6vw, 56px);
  color: #f0c93a;
  letter-spacing: 0.5px;
}

.landing-logo {
  height: 1em;
  width: auto;
  position: relative;
  top: 3px; /* nudge down slightly - the cropped logo's anti-aliased edge reads a touch high otherwise */
}

.landing .subtitle {
  font-size: clamp(14px, 2vw, 18px);
  font-weight: normal; /* countering the h1's default bold weight, now that this is a nested span rather than a separate <p> */
  color: #ffffff;
}

.narrow-break {
  display: none;
}

@media (max-width: 600px) {
  .narrow-break {
    display: inline;
  }
}

.card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  max-width: 900px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 320px;
  text-decoration: none;
  background: rgba(18, 20, 32, 0.96);
  border: 1px solid #22e8f0;
  border-radius: 12px;
  padding: 28px 26px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 8px rgba(34, 232, 240, 0.5);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:focus-visible {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(34, 232, 240, 0.85);
  transform: translateY(-2px);
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(34, 232, 240, 0.85);
    transform: translateY(-2px);
  }
}

.card.disabled {
  border-color: #3a3d55;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  cursor: not-allowed;
  opacity: 0.6;
}

@media (hover: hover) and (pointer: fine) {
  .card.disabled:hover {
    transform: none;
  }
}

.card h2 {
  margin: 0;
  font-size: 20px;
  color: #ffffff;
}

.card p {
  margin: 0;
  font-size: 14px;
  color: #c6c9db;
  line-height: 1.5;
}

.card .card-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #1a1608;
  background: #f0c93a;
  padding: 3px 8px;
  border-radius: 999px;
}

.card.disabled .card-tag {
  color: #a9adc1;
  background: #2a2f47;
}

.placeholder-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.placeholder-page h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 32px);
  color: #f0c93a;
}

.placeholder-page p {
  margin: 0;
  max-width: 480px;
  color: #a9adc1;
  font-size: 15px;
  line-height: 1.6;
}
