/* ==========================================================================
   Life on Rebun Island: concept stylesheet
   Palette is taken from the island and from the tourism badge.
   ========================================================================== */

/* ---- Fonts (self-hosted, Latin subsets only) ---------------------------- */
@font-face { font-family: "Zen Maru Gothic"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("fonts/zen-maru-gothic-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Zen Maru Gothic"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("fonts/zen-maru-gothic-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Zen Maru Gothic"; font-weight: 900; font-style: normal; font-display: swap;
  src: url("fonts/zen-maru-gothic-latin-900-normal.woff2") format("woff2"); }
/* Just the three characters in 礼文島 (1 KB). Anything else falls back to a system Japanese font. */
@font-face { font-family: "Zen Maru Gothic"; font-weight: 900; font-style: normal; font-display: swap;
  src: url("fonts/zen-maru-kanji-900.woff2") format("woff2");
  unicode-range: U+793C, U+6587, U+5CF6; }
@font-face { font-family: "Literata"; font-weight: 200 900; font-style: normal; font-display: swap;
  src: url("fonts/literata-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-weight: 200 900; font-style: italic; font-display: swap;
  src: url("fonts/literata-latin-wght-italic.woff2") format("woff2"); }

/* ---- Tokens ------------------------------------------------------------- */
:root {
  --kombu: #15302c;        /* kelp: text, footer */
  --kombu-soft: #3b544f;   /* secondary text */
  --fog: #edf4f4;          /* sea fog: page background */
  --paper: #fbfefe;        /* journal pages */
  --teal: #0d7074;         /* badge teal, deepened for contrast */
  --teal-deep: #0a565a;
  --sun: #f4b729;          /* badge yellow */
  --sun-tint: #fff2cb;     /* food band */
  --coral: #e8704d;        /* badge wave */
  --sea: #0b3a6b;         /* Rishiri blue, hero shading */
  --line: rgba(21, 48, 44, .16);

  --display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --text: "Literata", Georgia, "Times New Roman", serif;

  --measure: 40rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --focus: var(--teal-deep);
  --topbar-h: 4rem;
}

/* ---- Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 1rem); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fog); color: var(--kombu);
  font: 400 1.125rem/1.7 var(--text); text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; }
a { color: var(--teal); text-underline-offset: .18em; }
a:hover { color: var(--teal-deep); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 900; line-height: 1.12; margin: 0; letter-spacing: -.005em; }
p { margin: 0 0 1.1em; }

.skip { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--kombu); color: #fff;
  padding: .6rem 1rem; border-radius: 999px; font-family: var(--display); font-weight: 700; }
.skip:focus { top: .75rem; }
.wrap { width: min(100% - 2 * var(--gutter), 68rem); margin-inline: auto; }

/* ---- Buttons ------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .75rem 1.5rem; border-radius: 999px;
  background: var(--teal); color: #fff; text-decoration: none;
  font: 700 1rem/1.2 var(--display); transition: background-color .2s; }
.btn:hover { background: var(--teal-deep); color: #fff; }
.btn--sun { background: var(--sun); color: var(--kombu); }
.btn--sun:hover { background: #ffc94d; color: var(--kombu); }
.btn--ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .8); }
.btn--ghost:hover { background: rgba(255, 255, 255, .16); color: #fff; }

/* ---- Green banner (the original header colour, kept on request) --------- */
.banner { background: #3bce78; display: flex; justify-content: center; padding: clamp(.5rem, 1.2vw, 1rem) var(--gutter); }
.banner img { display: block; width: clamp(100px, 13vw, 150px); height: auto; }

/* ---- Top bar ------------------------------------------------------------ */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: .5rem; padding-inline: var(--gutter);
  background: rgba(237, 244, 244, .94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--kombu); flex: none;
  font: 900 1.05rem/1.1 var(--display); }
.brand img { width: 44px; height: auto; display: block; }
.brand span { display: none; }
.topbar nav { margin-left: auto; min-width: 0; }
.topbar ul { display: flex; gap: .15rem; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.topbar ul::-webkit-scrollbar { display: none; }
.topbar nav a { display: block; padding: .55rem .8rem; white-space: nowrap; text-decoration: none; color: var(--kombu);
  font: 700 .95rem/1 var(--display); border-radius: 999px; transition: background-color .2s; }
.topbar nav a:hover { background: rgba(13, 112, 116, .1); color: var(--kombu); }
.topbar nav a[aria-current="true"] { background: var(--sun); }
@media (min-width: 900px) { .brand span { display: block; } }

/* ---- Hero --------------------------------------------------------------- */
.hero { position: relative; isolation: isolate; overflow: hidden; color: #fff;
  min-height: clamp(32rem, 86vh, 54rem); display: grid; grid-template-rows: auto 1fr; --focus: var(--sun); }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 52% 45%; z-index: -2; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(6, 28, 58, .9) 0%, rgba(6, 28, 58, .6) 26%, rgba(6, 28, 58, 0) 52%); }
/* bottle-cap scallop along the bottom edge, from the badge */
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 14px; z-index: 1;
  background: radial-gradient(circle 14px at 50% 0, transparent 13px, var(--fog) 13.6px) 0 0 / 28px 14px repeat-x; }
/* the island's name in kanji, set in the clear sky above Rishiri */
.hero .kanji { width: min(100% - 2 * var(--gutter), 68rem); margin: clamp(1.25rem, 4vw, 3rem) auto 0;
  font: 900 clamp(4rem, 12vw, 9rem)/1 var(--display); color: var(--sea); letter-spacing: .04em; }
.hero-inner { align-self: end; width: min(100% - 2 * var(--gutter), 68rem); margin-inline: auto; padding-block: 4rem clamp(3rem, 7vw, 5.5rem); }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.75rem); line-height: 1.05; }
.hero .lede { max-width: 34rem; margin: 1rem 0 1.5rem; font-size: clamp(1.05rem, 1.7vw, 1.25rem); line-height: 1.55; color: #e6f1f4; }
.hero .actions { display: flex; flex-wrap: wrap; gap: .75rem; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.hero .kanji { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero h1 { animation: rise .9s .12s cubic-bezier(.2, .7, .2, 1) both; }
.hero .lede { animation: rise .9s .22s cubic-bezier(.2, .7, .2, 1) both; }
.hero .actions { animation: rise .9s .32s cubic-bezier(.2, .7, .2, 1) both; }

@media (max-width: 700px) { .hero > img { object-position: 49% 45%; } }

/* ---- Intro -------------------------------------------------------------- */
.intro { padding-block: clamp(3rem, 7vw, 5.5rem) clamp(2.5rem, 6vw, 4rem); }
.intro-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
.intro .atsumo { width: clamp(120px, 18vw, 200px); display: block; }
.intro p.facts { max-width: 36rem; color: var(--kombu-soft); }
.intro blockquote { margin: 0 0 1.4rem; max-width: 34rem; }
.intro blockquote p { font: italic 500 clamp(1.5rem, 3.2vw, 2.25rem)/1.3 var(--text); margin: 0 0 .5rem; }
.intro blockquote footer { font: 700 .95rem/1.3 var(--display); margin-top: .6rem; }
.intro .note { margin: 1.5rem 0 0; padding-left: 1rem; border-left: 4px solid var(--sun); max-width: 34rem; font-size: 1rem; line-height: 1.5; }
.intro .note strong { font-family: var(--display); display: block; }
@media (max-width: 640px) {
  .intro-grid { grid-template-columns: 1fr; }
  .intro .atsumo { width: 120px; }
}

/* ---- Section headings --------------------------------------------------- */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section h2 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
.section-head { display: flex; align-items: flex-end; gap: 1.5rem; margin-bottom: 1.75rem; }
.section-head p { margin: .6rem 0 0; color: var(--kombu-soft); max-width: 32rem; }
.band-paper { background: var(--paper); }
.band-sun { background: var(--sun-tint); }

/* ---- Journal ------------------------------------------------------------ */
.journal { background: var(--paper); }
.journal-head { width: min(100% - 2 * var(--gutter), 50rem); }
.journal-head .sub { margin: .6rem 0 0; color: var(--kombu-soft); }
.months { display: flex; flex-wrap: wrap; gap: .4rem .6rem; margin: 2rem 0 0; padding: 0; list-style: none; }
.months a { text-decoration: none; display: block; }

/* stamp = the badge's scalloped circle */
.stamp { display: grid; place-content: center; text-align: center; width: 7rem; aspect-ratio: 1;
  background: url("images/web/stamp.svg") center / contain no-repeat; color: #fff; line-height: 1; font-family: var(--display); }
.stamp .m { font-weight: 900; font-size: 1.85rem; }
.stamp .y { font-weight: 700; font-size: .8rem; margin-top: .3em; letter-spacing: .04em; }
.stamp--mini { width: 3.4rem; }
.stamp--mini .m { font-size: 1rem; }
.months a:hover .stamp--mini { filter: brightness(1.15); }

.entry { display: grid; grid-template-columns: 7rem minmax(0, var(--measure)); column-gap: clamp(1.5rem, 4vw, 3rem);
  justify-content: center; padding-block: 3.5rem; }
.entry + .entry { border-top: 1px solid var(--line); }
.entry .stamp-col { position: sticky; top: calc(var(--topbar-h) + 1.5rem); align-self: start; }
.entry h3 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); margin: .2rem 0 .9rem; }
.entry-body p:last-of-type { margin-bottom: 0; }
.entry-body p { hyphens: auto; }

.photo { position: relative; margin: 1.9rem 0 0; }
.photo button { display: block; width: 100%; padding: 0; border: 0; background: var(--fog); cursor: zoom-in; }
.photo img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: var(--focus-xy, 50% 50%); }
.photo .expand { position: absolute; right: .75rem; bottom: .75rem; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  background: rgba(21, 48, 44, .72); color: #fff; display: grid; place-items: center; pointer-events: none; }
.photo .expand svg { width: 1.1rem; height: 1.1rem; }
.photo button:hover + .expand { background: var(--teal); }

@media (max-width: 480px) {
  .months { gap: .3rem; }
  .stamp--mini { width: 2.6rem; }
  .stamp--mini .m { font-size: .78rem; }
}
@media (max-width: 760px) {
  .entry { grid-template-columns: 1fr; padding-block: 2.75rem; }
  .entry .stamp-col { position: static; margin-bottom: .5rem; }
  .stamp { width: 5.25rem; }
  .stamp .m { font-size: 1.4rem; }
  .stamp .y { font-size: .68rem; }
}

/* ---- Food --------------------------------------------------------------- */
.hokkepi { height: clamp(120px, 18vw, 190px); width: auto; flex: none; transform: rotate(5deg); margin-bottom: -.5rem; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 0 0 2.25rem; }
.pair figure, .mosaic figure { margin: 0; }
.pair img, .mosaic img { display: block; width: 100%; object-fit: cover; }
.pair img { aspect-ratio: 4 / 3; }
figcaption { margin-top: .55rem; font: 700 .95rem/1.35 var(--display); color: var(--kombu-soft); }
.prose { max-width: var(--measure); }
@media (max-width: 640px) { .pair { grid-template-columns: 1fr; } }

/* ---- Sightseeing -------------------------------------------------------- */
.mosaic { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 0 0 2.25rem; }
.mosaic .wide { grid-column: 1 / -1; }
.mosaic .wide img { aspect-ratio: 21 / 9; }
.mosaic .half img { aspect-ratio: 4 / 3; }
.map { display: block; width: 100%; height: 34rem; margin-top: 2rem; background: #fff; border: 2px solid var(--kombu); }
.map p { padding: 1.5rem; }
@media (max-width: 640px) { .mosaic { grid-template-columns: 1fr; } .mosaic .wide img { aspect-ratio: 4 / 3; } .map { height: 26rem; } }

/* ---- Getting around (timetable-style list) ------------------------------ */
.modes { margin: 2rem 0; padding: 0; max-width: 46rem; }
.modes > div { display: grid; grid-template-columns: minmax(7.5rem, 11rem) minmax(0, 1fr); gap: .25rem 2rem;
  padding-block: 1.25rem; border-top: 2px solid var(--kombu); }
.modes > div:last-child { border-bottom: 2px solid var(--kombu); }
.modes dt { font: 900 1.2rem/1.25 var(--display); }
.modes dd { margin: 0; }
.modes dd p:last-child { margin-bottom: 0; }
.modes dd strong { font-family: var(--display); font-weight: 700; }
@media (max-width: 640px) { .modes > div { grid-template-columns: 1fr; } }

/* ---- Survey ------------------------------------------------------------- */
.survey { position: relative; background: var(--teal); color: #fff; padding-block: clamp(4rem, 9vw, 6.5rem) clamp(3rem, 7vw, 5rem); --focus: var(--sun); }
.survey::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 14px;
  background: radial-gradient(circle 14px at 50% 100%, transparent 13px, var(--fog) 13.6px) 0 0 / 28px 14px repeat-x; }
.survey h2 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
.survey p { max-width: 36rem; }
.survey .frame { background: #fff; padding: .5rem; max-width: 46rem; margin-top: 2rem; }
.survey iframe { display: block; width: 100%; height: 600px; border: 0; }

/* ---- Footer ------------------------------------------------------------- */
.site-footer { background: var(--kombu); color: #d6e6e2; padding-block: 3.5rem 3rem; --focus: var(--sun); }
.site-footer .wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.5rem 2.5rem; align-items: center; }
.site-footer img { width: 110px; height: auto; display: block; }
.site-footer h2 { font-size: 1.5rem; color: #fff; margin-bottom: .4rem; }
.site-footer p { margin: 0 0 1rem; max-width: 34rem; font-size: 1rem; line-height: 1.55; }
.social { display: flex; gap: .4rem; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.social a { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; color: #d6e6e2;
  box-shadow: inset 0 0 0 2px rgba(214, 230, 226, .4); transition: background-color .2s, color .2s; }
.social a:hover { background: var(--sun); color: var(--kombu); box-shadow: none; }
.social svg { width: 1.2rem; height: 1.2rem; }
@media (max-width: 560px) { .site-footer .wrap { grid-template-columns: 1fr; } .site-footer img { width: 88px; } }

/* ---- Back to top -------------------------------------------------------- */
.totop { position: fixed; right: 1rem; bottom: 1rem; z-index: 40; width: 3rem; height: 3rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--kombu); color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .25s, transform .25s, visibility .25s; }
.totop.is-visible { opacity: 1; visibility: visible; transform: none; }
.totop:hover { background: var(--teal); color: #fff; }
.totop svg { width: 1.1rem; height: 1.1rem; }

/* ---- Lightbox ----------------------------------------------------------- */
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh;
  color: #fff; --focus: var(--sun); }
dialog.lightbox::backdrop { background: rgba(8, 22, 20, .92); }
dialog.lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; align-items: center;
  gap: .75rem; padding: 1rem; animation: fade .2s ease-out; }
dialog.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
dialog.lightbox p { margin: 0; font: 500 .95rem/1.4 var(--display); text-align: center; }
dialog.lightbox .close { position: absolute; top: 1rem; right: 1rem; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; }
dialog.lightbox .close:hover { background: rgba(255, 255, 255, .3); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- Utilities ---------------------------------------------------------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
