/* Tip pages (/go/<target>, /go/tips, /404). Same fanzine vocabulary as the
   inner pages in home.css (paper, double rules, receipts); each tip adds its
   own app color through --tip-color. Everything is scoped under .tip-page. */

.tip-page { --tip-color: var(--accent); }

.tip-page .tip-crumbs {
  padding: 18px 0 0;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.tip-page .tip-crumbs a,
.tip-page .tip-more a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1.5px solid var(--tip-color);
}
.tip-page .tip-crumbs a:hover,
.tip-page .tip-more a:hover { color: var(--ink); }

/* ── Article ─────────────────────────────────────────────── */

.tip-article {
  max-width: 760px;
  margin: 22px auto 0;
}

.tip-hero {
  position: relative;
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--tip-color);
  background: var(--tip-color);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.tip-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tip-hero::after {
  /* Melts the illustration into the tip color behind the title, like the
     app's hero. The color comes from the app (MyColors). */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 35%,
    color-mix(in srgb, var(--tip-color) 92%, transparent) 100%);
}
.tip-hero h1 {
  position: absolute;
  left: 22px; right: 22px; bottom: 18px;
  z-index: 1;
  color: #fff;
  font-size: clamp(24px, 4.4vw, 40px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.tip-fallback {
  margin-top: 18px;
  padding: 10px 14px;
  border: 1px dashed var(--rule);
  font-size: 12px;
  color: var(--ink-mute);
}

.tip-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 28px;
}

.tip-section,
.tip-note {
  background: var(--paper);
  border: 1px solid var(--border);
  border-left: 4px solid var(--tip-color);
  padding: 20px 22px;
  box-shadow: 3px 3px 0 var(--paper-3, rgba(0, 0, 0, 0.06));
}
.tip-section h2 {
  font-size: 19px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 10px;
}
.tip-section p,
.tip-note p {
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.tip-section p + p,
.tip-note p + p { margin-top: 10px; }

.tip-note {
  background: color-mix(in srgb, var(--tip-color) 9%, var(--paper));
  border-style: dashed;
  border-left-style: solid;
}

.tip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.tip-action {
  display: inline-block;
  min-height: 40px;
  padding: 8px 14px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--tip-color);
  transition: transform 0.1s, box-shadow 0.1s;
}
.tip-action:hover,
.tip-action:focus-visible {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--tip-color);
}
.tip-action:focus-visible,
.tip-page a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.tip-action.app { border-style: dashed; }
.tip-action-where { color: var(--ink-mute); }

.tip-community {
  max-width: 760px;
  margin: 26px auto 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

/* ── Get the app (reuses .h-stores from home.css) ─────────── */

.tip-get-app { margin-top: 44px; scroll-margin-top: 32px; }

/* Arriving from an "in the app" action: glide down and make the store
   buttons impossible to miss. */
@media (prefers-reduced-motion: no-preference) {
  html:has(.tip-page) { scroll-behavior: smooth; }
  .tip-get-app:target { animation: tip-app-arrive 0.9s ease-out 0.35s 2; }
  .tip-get-app:target .h-store-btn { animation: tip-app-nudge 0.9s ease-out 0.35s 2; }
}
.tip-get-app:target { box-shadow: 8px 8px 0 var(--accent-bright), 0 0 0 4px var(--accent-bright); }

@keyframes tip-app-arrive {
  0%   { box-shadow: 8px 8px 0 var(--accent-bright), 0 0 0 0 var(--accent-bright); }
  40%  { box-shadow: 8px 8px 0 var(--accent-bright), 0 0 0 10px var(--accent-bright); }
  100% { box-shadow: 8px 8px 0 var(--accent-bright), 0 0 0 4px var(--accent-bright); }
}
@keyframes tip-app-nudge {
  0%, 100% { transform: none; }
  40%      { transform: translate(-3px, -3px); box-shadow: 4px 4px 0 var(--accent-bright); }
}

/* ── More tips ────────────────────────────────────────────── */

.tip-more {
  max-width: 760px;
  margin: 40px auto 0;
  padding-top: 22px;
  border-top: 3px double var(--rule);
}
.tip-more h2 {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 14px;
}
.tip-more ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Index (/go/tips) ─────────────────────────────────────── */

.tip-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.tip-grid li { --tip-color: var(--accent); }
.tip-card {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--tip-color);
  overflow: hidden;
  text-decoration: none;
  background: var(--tip-color);
  transition: transform 0.1s, box-shadow 0.1s;
}
.tip-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--tip-color); }
.tip-card img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.tip-card::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top,
    color-mix(in srgb, var(--tip-color) 95%, #000 5%) 0%, transparent 70%);
}
.tip-card-title {
  position: absolute;
  left: 14px; right: 14px; bottom: 12px;
  z-index: 1;
  color: #fff;
  font-size: 15px;
  line-height: 1.25;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.tip-not-found .tip-actions { margin-top: 22px; }

/* ── Small screens ────────────────────────────────────────── */

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

@media (max-width: 600px) {
  .tip-article { margin-top: 16px; }
  .tip-hero { aspect-ratio: 4 / 3; box-shadow: 4px 4px 0 var(--tip-color); }
  .tip-hero h1 { left: 14px; right: 14px; bottom: 12px; }
  .tip-section, .tip-note { padding: 16px; }
  .tip-section h2 { font-size: 17px; }
  .tip-section p, .tip-note p { font-size: 13.5px; }
  .tip-more ul { grid-template-columns: 1fr; }
  .tip-grid { grid-template-columns: 1fr; }
}

/* ── Home entry point (lib/components/home/home_tips.dart) ── */

.h-tips { margin-top: 28px; }
.h-tips-all {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 18px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.04em;
  transition: transform 0.1s;
}
.h-tips-all:hover, .h-tips-all:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--accent-bright);
}

/* ── "In the app" dialog (TipAppDialog, opened by home.js) ── */

.tip-app-dialog {
  margin: auto;
  width: min(420px, calc(100vw - 32px));
  padding: 28px 24px 24px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--accent-bright);
}
.tip-app-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.tip-app-dialog-close {
  position: absolute;
  top: 8px; right: 10px;
  width: 36px; height: 36px;
  border: 0;
  background: none;
  color: var(--ink-mute);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.tip-app-dialog-close:hover, .tip-app-dialog-close:focus-visible { color: var(--ink); }
.tip-app-dialog-what {
  margin: 0 28px 14px 0;
  padding-left: 12px;
  border-left: 2px solid var(--tip-color, var(--accent));
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.tip-app-dialog-what:empty { display: none; }
.tip-app-dialog h3 {
  margin: 0 28px 8px 0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.tip-app-dialog-text {
  margin-bottom: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.tip-app-dialog .h-stores-buttons { min-width: 0; }
