/* global.css — Shared design tokens, reset, and components */

/* ============================================================
   Design tokens
   ============================================================ */

:root {
  /* Previa palette */
  --color-previa-teal:        #1D9E75;
  --color-previa-teal-light:  #E1F5EE;
  --color-previa-teal-dark:   #085041;
  --color-previa-amber:       #854F0B;
  --color-previa-amber-light: #FAEEDA;
  --color-previa-red:         #A32D2D;
  --color-previa-red-light:   #FCEBEB;

  /* PinARt palette — TBD */
  --color-pinart-primary: #333333;

  /* Shared */
  --color-text-primary:   #1A1A1A;
  --color-text-secondary: #5A5A5A;
  --color-text-tertiary:  #9A9A9A;
  --color-background:     #FAFAF9;
  --color-surface:        #F2F2F0;
  --color-surface-raised: #FFFFFF;
  --color-border:         #E8E8E6;
  --color-border-subtle:  #F0F0EE;
  --color-accent:         #1D9E75; /* default; overridden per-app */

  /* Layout */
  --page-max-width:    980px;
  --pad-x-mobile:      20px;
  --pad-x-desktop:     48px;
  --section-gap:       80px;
  --component-gap:     24px;

  /* Type scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  clamp(1.75rem, 4vw, 2.25rem);
  --text-4xl:  clamp(2.25rem, 6vw, 3.25rem);

  /* Radius */
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-icon: 22.5%;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.04);

  /* Transitions */
  --transition:      150ms ease;
  --transition-slow: 250ms ease;
}

/* ============================================================
   Reset
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text-primary);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

ul, ol { padding-left: 1.5em; }

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
}

h1 { font-size: var(--text-4xl); margin-bottom: 0.5em; }
h2 { font-size: var(--text-3xl); margin-top: 2em;   margin-bottom: 0.5em; }
h3 { font-size: var(--text-xl);  margin-top: 1.75em; margin-bottom: 0.4em; }
h4 { font-size: var(--text-lg);  margin-top: 1.5em;  margin-bottom: 0.3em; }

p  { margin-bottom: 1em; }
li { margin-bottom: 0.35em; }

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--section-gap) 0;
}

strong { font-weight: 600; }

/* ============================================================
   Layout
   ============================================================ */

.page-wrapper {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 var(--pad-x-mobile);
}

@media (min-width: 768px) {
  .page-wrapper { padding: 0 var(--pad-x-desktop); }
}

/* ============================================================
   Site header
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 249, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--color-border-subtle);
}

.site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  height: 60px;
}

.site-header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.site-header__logo:hover { opacity: 0.75; text-decoration: none; }

.site-header__logomark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-icon);
  display: block;
}

/* ============================================================
   Site nav
   ============================================================ */

.site-nav {
  display: flex;
  align-items: center;
  gap: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.site-nav__link {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.site-nav__link:hover {
  color: var(--color-text-primary);
  background: var(--color-surface);
  text-decoration: none;
}

.site-nav__link--active {
  color: var(--color-text-primary);
  font-weight: 600;
}

/* Push lang switcher to right edge */
.lang-switcher__select {
  margin-left: auto;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
}

.lang-switcher__select:hover {
  border-color: var(--color-text-tertiary);
}

/* ============================================================
   App hero
   ============================================================ */

.app-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 56px 0 40px;
  text-align: center;
}

.app-hero__icon {
  width: 108px;
  height: 108px;
  border-radius: var(--radius-icon);
  box-shadow: var(--shadow-lg);
}

/* App Store badge */
.appstore-link { display: inline-block; }
.appstore-link:hover { opacity: 0.82; text-decoration: none; transition: opacity var(--transition); }
.appstore-badge { height: 44px; width: auto; }

/* ============================================================
   Content area
   ============================================================ */

.content {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: var(--section-gap);
}

.content h1 { margin-top: 0; }
.content h2:first-child,
.content h1:first-child { margin-top: 0; }

/* Screenshots embedded in content */
.content img {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin: var(--component-gap) auto;
  border: 1px solid var(--color-border-subtle);
}

/* ============================================================
   Guide download buttons
   ============================================================ */

.guide-downloads {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding: var(--component-gap) 0 var(--section-gap);
}

.guide-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-primary);
  background: var(--color-surface-raised);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.guide-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

/* ============================================================
   Last updated
   ============================================================ */

.last-updated {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  text-align: center;
  padding-bottom: var(--section-gap);
}

/* ============================================================
   Site footer
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--color-border-subtle);
  padding: var(--component-gap) 0 28px;
  background: var(--color-background);
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer__copy {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin: 0;
}

.site-footer__links {
  display: flex;
  gap: 24px;
}

.site-footer__links a {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  transition: color var(--transition);
  text-decoration: none;
}

.site-footer__links a:hover {
  color: var(--color-text-primary);
  text-decoration: none;
}

/* ============================================================
   Studio homepage
   ============================================================ */

.studio-hero {
  padding: 80px 0 64px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: linear-gradient(160deg, rgba(0, 227, 199, 0.13) 0%, var(--color-background) 65%);
  margin: 0 calc(-1 * var(--pad-x-mobile));
  padding-left: var(--pad-x-mobile);
  padding-right: var(--pad-x-mobile);
  border-bottom: 1px solid rgba(0, 227, 199, 0.18);
}

@media (min-width: 768px) {
  .studio-hero {
    margin: 0 calc(-1 * var(--pad-x-desktop));
    padding-left: var(--pad-x-desktop);
    padding-right: var(--pad-x-desktop);
  }
}

.studio-hero__logo {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-icon);
  box-shadow: var(--shadow-lg);
  margin-bottom: 8px;
}

.studio-hero__name {
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #00E3C7;
  margin: 0;
  line-height: 1;
}

.studio-hero__name-suffix {
  font-weight: 400;
}

.studio-hero__tagline {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: var(--color-text-secondary);
  font-weight: 400;
  max-width: 480px;
  margin: 4px 0 0;
  letter-spacing: -0.01em;
  line-height: 1.5;
}

.studio-hero__desc {
  font-size: var(--text-base);
  color: var(--color-text-tertiary);
  max-width: 440px;
  margin: 0;
  line-height: 1.65;
}

/* ============================================================
   App grid & cards
   ============================================================ */

.app-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 0 0 var(--section-gap);
}

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

.app-card {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 36px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow var(--transition-slow), transform var(--transition-slow), border-color var(--transition-slow);
  text-decoration: none;
}

.app-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--color-border-subtle);
}

.app-card__icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-icon);
  box-shadow: var(--shadow-md);
}

.app-card__name {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 4px 0 0;
  color: var(--color-text-primary);
}

.app-card__desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0;
  flex: 1;
  line-height: 1.65;
}

.app-card__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.app-card__learn {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.app-card__learn:hover { text-decoration: underline; }

/* ============================================================
   404 page
   ============================================================ */

.page-404 {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--section-gap) var(--pad-x-mobile);
  gap: 20px;
}

.page-404__code {
  font-size: clamp(5rem, 18vw, 9rem);
  font-weight: 800;
  color: var(--color-border);
  line-height: 1;
  letter-spacing: -0.05em;
}

.page-404__message {
  font-size: var(--text-xl);
  color: var(--color-text-secondary);
  letter-spacing: -0.01em;
}

.page-404__home {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  background: var(--color-text-primary);
  color: #fff;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: opacity var(--transition);
  letter-spacing: -0.01em;
  font-family: inherit;
}

.page-404__home:hover { opacity: 0.8; text-decoration: none; }
