/* 색 토큰. --sea, --wave, --sand 는 data/make_shore.py 의 그림과 같은 값이다 */
:root {
  --sea: #123A47;      /* 바다 */
  --wave: #3E7C8A;     /* 물결선, 이름 밑줄 */
  --sand: #E2CFA4;     /* 모래: 해안, 바다 위 강조 */
  --paper: #F4F3EE;    /* 땅 */
  --ink: #14202A;      /* 글자 */
  --foam: #D8E7E6;     /* 바다 위 둘째 글자 */
  --ink-2: #47545C;    /* 땅 위 둘째 글자 */
  --tint: #E9E3CF;     /* 누르는 동안 물드는 땅 */

  --display: "Gowun Batang", "AppleMyungjo", "Batang", serif;
  --text: "Gothic A1", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --n: 3;              /* 프로젝트 수. main.js 가 맞춘다. 첫 그림이 밀리지 않게 실제 수로 둔다 */
  --g: 16px;           /* 가장자리 여백 */
  --t: 17px;           /* 본문 크기 */
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; background: var(--sea); }
body {
  margin: 0;
  background: var(--sea);
  color: var(--ink);
  font: 500 var(--t)/1.6 var(--text);
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
.skip {
  position: absolute; left: 16px; top: -80px; z-index: 10;
  background: var(--ink); color: #fff; padding: 12px 16px; min-height: 44px;
}
.skip:focus { top: 12px; }

/* 겹: 바다 < 물결 < 오늘 < 땅(해안선으로 잘림) < 지명, 늘보 */
/* clip 은 스크롤 상자를 만들지 않는다. hidden 만 두면 앵커 이동이나 키보드 포커스가 넘친 물결 그림 쪽으로 이 상자를 밀어 올려,
   사용자가 되돌릴 수 없게 화면 위쪽이 사라진다. hidden 은 clip 을 모르는 옛 브라우저용이다 */
.page { position: relative; overflow: hidden; overflow: clip; }
.water { position: absolute; z-index: 0; pointer-events: none; background-repeat: no-repeat; background-size: 100% 100%; }
.land { position: relative; z-index: 2; background: var(--paper); }
.today { position: relative; z-index: 1; color: #fff; }
.places, .sloth { z-index: 3; pointer-events: none; }

/* 지명은 정적 자료. 어느 화면에서도 같은 곳에 같은 수로 나온다 */
.places { position: absolute; inset: 0; }
.pl {
  position: absolute;
  left: calc(var(--x0) + var(--u) * var(--x, 0) + var(--pl-gap, 16px));
  top: calc(var(--u) * var(--y, 0));
  transform: translateY(-50%);
  font: 700 16px/1 var(--display); color: var(--foam); white-space: nowrap;
}
.sloth {
  position: absolute; width: 140px; height: 140px; margin: -70px 0 0 -70px; overflow: visible;
  left: calc(var(--x0) + var(--u) * var(--sx, 0)); top: calc(var(--u) * var(--sy, 0));
}
.sloth .arm { fill: none; stroke: var(--sand); stroke-width: 6.5; stroke-linecap: round; }
.sloth .thin { stroke-width: 5; }
.sloth .fur { fill: var(--sand); }
.sloth .mask { fill: var(--paper); }
.sloth .eye { fill: var(--ink); }
.sloth .mouth { fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; }
.sloth .stripe { fill: none; stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; }

/* 땅 */
.land-in > *:not(.shape-land) { margin-left: var(--g); padding-right: 12px; }
.brand { padding-top: 20px; }
.who { font: 700 28px/1.2 var(--display); }
.by { color: var(--ink-2); font-size: 16px; line-height: 1.5; }
h1 { margin-top: 18px; font: 700 clamp(28px, 8vw, 40px)/1.26 var(--display); letter-spacing: -.01em; }
.lead { margin-top: 10px; line-height: 1.55; }
.lead a {
  display: inline-block; position: relative; font-weight: 700; white-space: nowrap;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--wave);
}
/* 누르는 자리는 글줄 높이 밖으로 넓힌다. 위아래로 겹치지 않게 칸마다 넓히는 쪽을 정한다 */
.lead a::before { content: ""; position: absolute; left: 0; right: 0; top: -9px; bottom: -9px; }
/* 줄 간격이 26px 이라 테두리는 윗줄과 옆 글자를 긋는다. 포커스는 글자를 뒤집어 표시한다 */
.lead a:focus-visible { outline: none; background: var(--ink); color: var(--paper); text-decoration-color: var(--sand); }

.tools { margin-top: 18px; outline: none; min-height: 500px; }
.group + .group { margin-top: 12px; }
.group h2 { font: 700 16px/1.5 var(--text); color: var(--ink-2); padding: 4px 0; }
.row {
  display: block; position: relative; text-decoration: none;
  margin-left: calc(var(--g) * -1); padding: 7px 0 9px var(--g); min-height: 44px;
  transition: background-color 150ms ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.name {
  display: block; font: 700 24px/1.3 var(--display);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px;
  text-decoration-color: var(--wave);
  transition: text-decoration-color 150ms ease;
}
.line { display: block; font-size: 16px; line-height: 1.5; margin-top: 5px; text-wrap: pretty; }  /* 줄 끝 외톨이 낱말을 막는다 */
.line-long, .fact { display: none; }
.line-short[data-id="now"] { min-height: 3em; }  /* 살아 있는 문장이 들어와도 아래 줄이 밀리지 않게 */
.fact { color: var(--ink-2); font-size: 16px; line-height: 1.5; }

/* 바다 */
.today { background: var(--sea); }
.today-in { padding: 28px var(--g) 24px; }
.shape-sea { display: none; pointer-events: none; }  /* 띄운 상자가 링크의 빈자리 위에 올라와 누름을 뺏지 않게 */
.today h2 { font: 700 1.55em/1.3 var(--display); }
.stamp { color: var(--foam); font-size: max(16px, .94em); }
.say { margin-top: 14px; font: 700 clamp(24px, 6.6vw, 30px)/1.42 var(--display); }
.say .end { display: block; }
.say a { position: relative; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: var(--sand); }
.say a::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; bottom: -10px; }  /* 안쪽 여백으로 넓히면 포커스 테두리가 다음 줄을 긋는다 */
.say a:focus-visible { outline-offset: 1px; }
.say-note { margin-top: 6px; color: var(--foam); font-size: max(16px, .94em); }
.part { margin-top: 22px; }
.part h3 { font: 700 1.24em/1.4 var(--display); color: var(--sand); }
.part ul { margin-top: 4px; }
.part li { padding: 3px 0; line-height: 1.5; }
.plain { color: var(--foam); font-size: max(16px, .94em); }
/* 바다의 링크는 모두 글줄로 접히는 블록이다. 통짜 상자는 좁은 바다에 안 들어가면 해안선 끝까지 밀려 내려간다 */
.more, .bene { display: block; min-height: 44px; text-decoration: none; touch-action: manipulation; }
.more { padding: 8px 0 9px; font-weight: 700; }
.more .t { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--sand); }
.benes li { padding: 0; }
.bene { padding: 7px 0 8px; }
.bene .t { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: var(--sand); }
.bene .plain { display: block; }
.wait, .fail { margin-top: 14px; color: var(--foam); }

.credit { position: relative; z-index: 3; color: var(--foam); font-size: 16px; line-height: 1.5; padding: 0 var(--g) 20px; }
.today-a .today-in { padding-bottom: 0; }
.today-b { padding-top: 0; }

/* 포커스: 줄은 해안선에서 잘리므로 테두리를 이름에 둔다 */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.today :focus-visible, .credit :focus-visible, .skip:focus-visible { outline-color: var(--sand); }
.row:focus-visible { outline: none; background: var(--tint); }
.row:focus-visible .name { outline: 3px solid var(--ink); outline-offset: 4px; }
.bene:focus-visible, .more:focus-visible { outline: none; }
.bene:focus-visible .t, .more:focus-visible .t { outline: 3px solid var(--sand); outline-offset: 3px; }

@media (hover: hover) {
  .row:hover { background: var(--tint); }
  .row:hover .name { text-decoration-color: var(--ink); }
  .more:hover .t, .say a:hover, .bene:hover .t { text-decoration-color: #fff; }
}
.row:active { background: var(--tint); }

/* 좁은 화면: 해안선을 모양 그대로 돌려 세운다. 축척은 가로세로 같다 */
@media (max-width: 1179.98px) {
  :root {
    --u: max(calc(100vw / 20.3), 19.2px);
    --Ht: calc(var(--u) * var(--km-tall));
    --x0: calc(100vw - var(--u) * 2.75 - max(15.4vw, 60px));
  }
  .p4 { --pl-gap: 10px; }   /* 정동진: 바다 쪽 여백이 가장 좁은 자리 */
  .credit { background: var(--sea); }   /* 물결 그림이 맨 아래까지 비치지 않게 */
  .water {
    background-image: url(water-tall.svg?v=20261115a);
    left: calc(var(--x0) - var(--u) * 3.2); top: calc(var(--u) * -3.2);
    width: calc(var(--u) * (var(--xmax-tall) + 6.4)); height: calc(var(--u) * (var(--km-tall) + 63.2));
  }
  .land { min-height: var(--Ht); }
  .land-in { width: calc(var(--x0) + var(--u) * var(--xmax-tall)); }
  /* 다각형의 마지막 변이 상자의 오른쪽 아래 끝까지 가므로, 옥계 아래 꼬리(make_shore.py 의 TAIL, 5 km)만큼 더 내려가면
     그 변이 곧 땅의 꼬리가 된다. 목록이 옥계를 넘어가도 글이 꼬리에 잘리지 않는다 */
  .shape-land { float: right; width: 100%; height: calc(var(--Ht) + var(--u) * 5); shape-margin: 12px; }
  .pl { --x: var(--tx); --y: var(--ty); }
  .sloth { --sx: var(--sxt); --sy: var(--syt); }
}
/* 폰: 글꼴이 늦게 와도 줄 수가 안 바뀌게 소개 문장의 끊는 자리를 정해 둔다 */
@media (max-width: 599.98px) {
  .lead span { display: block; }
  .lead span:first-child a::before { top: -20px; bottom: 0; }
  .lead span:last-child a::before { top: 0; bottom: -20px; }
}
@media (min-width: 373px) and (max-width: 599.98px) {
  /* 첫 줄은 내려앉지 않으므로 Gowun Batang 보다 넓은 대체 글꼴(애플명조, 폭 8.7em)도 해안선 안에 들어오는 크기로 잡는다 */
  h1 { font-size: min(calc((100vw - 48px) / 11.7), 34px); }
  h1 span { display: block; white-space: nowrap; }
}
@media (max-width: 380px) {
  .lead { font-size: 16px; }
}
@media (max-width: 372px) {
  .by span { display: block; }
}
@media (max-width: 340px) {
  .land-in > .tools { padding-right: 44px; }   /* 옥계 아래 해안이 넓어지는 자리에서 글줄 끝이 모래에 닿지 않게 */
}
/* 키 작은 폰: 첫 화면에 한 줄이라도 더 */
@media (max-width: 599.98px) and (max-height: 700px) {
  .brand { padding-top: 12px; }
  h1 { margin-top: 10px; }
  .tools { margin-top: 10px; }
  .group + .group { margin-top: 4px; }
  .row { padding-top: 4px; padding-bottom: 6px; }
}
@media (min-width: 600px) and (max-width: 1179.98px) {
  :root {
    --g: 32px;
    --u: min(calc(100vw / 20.3), calc(max(100svh, 640px) / 50));
    --x0: calc(100vw - var(--u) * 2.75 - max(150px, 17.5vw));
  }
  .brand { padding-top: 28px; }
  h1 { font-size: 46px; margin-top: 22px; line-height: 1.22; }
  h1 span { display: block; }
  .lead { font-size: 19px; }
  .line-long { display: block; }
  .line-short { display: none; }
  .fact { display: block; }
  .name { font-size: 28px; }
  .tools { min-height: calc(var(--n) * 140px); }   /* 이 폭에서는 목록이 땅을 늘린다. 자리를 미리 잡아 '오늘 강릉'이 밀리지 않게 */
  .today-in { max-width: 720px; }
}
@media (min-width: 900px) and (max-width: 1179.98px) {
  .tools { min-height: calc(var(--n) * 114px); }   /* 설명이 한 줄로 들어가는 폭: 실제 높이는 줄마다 113px 쯤이다 */
}

/* 넓은 화면: 북쪽이 위. 땅과 오늘을 한 칸에 겹쳐 페이지는 더 긴 쪽을 따른다 */
@media (min-width: 1180px) {
  :root {
    --g: 48px;
    --t: clamp(17px, 1.9vh, 22px);
    --x0: clamp(390px, 33vw, 720px);
    --vh: 100vh;
    /* 줄이 늘면 해안선도 커진다. 해안선이 커질수록 중간 대목이 바다 글 쪽으로 나오므로 폭의 68% 에서 멈춘다.
       그 뒤의 줄은 옥계 아래 곧은 선을 따라 내려간다 */
    --list-H: min(calc(var(--n) * 70px + 470px), 68vw);
    --floor: 900px;    /* 해안선 옆에 바다 글이 다 들어가는 높이. 혜택이 많아 '모두 보기'가 붙어도 들어간다 */
    --H: min(max(var(--vh), var(--floor), var(--list-H)), calc((100vw - var(--x0) - 96px) / .6854));
    --u: calc(var(--H) / var(--km-wide));
  }
  @supports (height: 100svh) {
    :root { --vh: 100svh; }
  }
  main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .land { grid-area: 1 / 1; align-self: start; }
  .today { grid-area: 1 / 1 / 3 / 2; }
  main::before { content: ""; grid-area: 2 / 1; position: relative; z-index: 0; background: var(--sea); }  /* 땅 아래로 물결과 모래선이 비치지 않게 */
  .water {
    background-image: url(water-wide.svg?v=20261115a);
    left: calc(var(--x0) - var(--u) * 3.2); top: calc(var(--u) * -3.2);
    width: calc(var(--u) * (var(--xmax-wide) + 6.4)); height: calc(var(--u) * (var(--km-wide) + 63.2));
  }
  .land { min-height: var(--H); }
  .land-in { width: calc(var(--x0) + var(--u) * var(--xmax-wide)); }
  .shape-land { float: right; width: 100%; height: var(--H); shape-margin: 28px; }
  .pl { --x: var(--wx); --y: var(--wy); }
  .sloth { --sx: var(--sxw); --sy: var(--syw); }

  .brand { padding-top: 26px; }
  .who { font-size: 1.76em; }
  .by { font-size: max(16px, .94em); }
  /* 제목 두 줄은 해안선 시작점에 맞춘 크기로 고정한다. 글꼴이 늦게 와도 줄이 바뀌지 않아 목록이 안 밀린다 */
  h1 { margin-top: 20px; font-size: min(calc(var(--x0) * .108), 66px); line-height: 1.22; }
  h1 span { display: block; white-space: nowrap; }
  .lead { font-size: 1.12em; }
  .tools { margin-top: 22px; min-height: 420px; padding-bottom: 56px; }  /* 맨 아래 출처 자리 */
  .group + .group { margin-top: 10px; }
  .group h2 { font-size: max(16px, .94em); }
  /* 이름 칸은 float 을 못 쓴다. float 끼리는 모양이 아니라 상자로 부딪쳐서 해안선 상자 밑으로 밀린다 */
  .row { padding: .47em 0 .53em calc(var(--g) + 14.7em); min-height: 60px; }
  .name { position: absolute; left: var(--g); top: .27em; font-size: 1.53em; white-space: nowrap; }
  .line-long { display: block; }
  .line-short { display: none; }
  .line, .fact { margin-top: 0; }
  .line { font-size: 1em; }
  .fact { display: block; font-size: max(16px, .94em); }

  .today { background: none; }
  /* 목록이 길면 땅이 곧은 선으로 더 내려간다. 띄운 상자도 조금 더 내려가서, 바다 글이 --H 를 넘어도 곧은 선 밑으로 들어가지 않게 한다 */
  .shape-sea { display: block; float: left; width: 100%; height: calc(var(--H) + max(0, var(--n) - 7) * 16px); shape-margin: 84px; }
  .today-in { margin-left: calc(100vw - var(--g) - min(620px, 33vw)); padding: 26px var(--g) 24px 0; }
  .today-a .today-in { padding-bottom: 0; }
  .today-b { padding-top: 0; padding-bottom: 8px; }
  .say { font-size: clamp(30px, 2.5vw, 44px); }
  .credit { grid-area: 1 / 1; align-self: end; color: var(--ink-2); width: calc(var(--x0) + var(--u) * 24); padding: 0 var(--g) 16px; }
}
/* 바다가 모자란 화면: 해안선의 기울기는 진짜 값이라 바꿀 수 없고, 1180px 이면 y=600 에서 바다 글 폭이 170px 뿐이다.
   행사까지만 해안선 옆에 두고, 주차와 혜택은 땅이 끝난 아래 온통 바다인 띠로 내린다.
   폭이 좁거나(1366 미만), 넓어도 세로가 긴 화면(1366×1024 처럼 14:9 보다 세로가 긴 것)이 여기 든다 */
@media (min-width: 1180px) and (max-width: 1365.98px), (min-width: 1180px) and (max-aspect-ratio: 14/9) {
  :root { --list-H: calc(var(--n) * 70px + 470px); --floor: 780px; }   /* 해안선 옆에 글이 적으니 끝까지 커져도 된다 */
  main { grid-template-rows: auto auto auto; }
  .tools { padding-bottom: 20px; }
  .today { display: contents; }
  .today-a { grid-area: 1 / 1; position: relative; z-index: 1; }
  .shape-sea { height: var(--H); }
  .today-b {
    grid-area: 2 / 1; position: relative; z-index: 1; background: var(--sea);
    margin-left: 0; padding: 6px var(--g) 28px;
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 56px;
  }
  .credit { grid-area: 3 / 1; align-self: auto; width: auto; color: var(--foam); background: var(--sea); padding: 0 var(--g) 20px; }
}
/* 바다가 모자라고 키도 작은 화면: 사실 줄이 접혀 목록이 낮다. 땅을 그만큼 줄여 주차와 혜택 띠를 첫 화면 끝에 붙인다 */
@media (min-width: 1180px) and (max-width: 1365.98px) and (max-height: 860px), (min-width: 1180px) and (max-aspect-ratio: 14/9) and (max-height: 860px) {
  :root { --list-H: calc(var(--n) * 62px + 420px); }
}
/* 키 작은 넓은 화면: 사실 줄을 접어 목록을 첫 화면에 둔다 */
@media (min-width: 1180px) and (max-height: 860px) {
  .fact { display: none; }
  .brand { padding-top: 18px; }
  h1 { margin-top: 12px; }
  .tools { margin-top: 12px; }
  .group + .group { margin-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .row, .name { transition: none; }
}

/* 바다가 모자란 화면에서만 나오는 안내 한 줄. 주차와 혜택이 첫 화면 아래에 있다고 알려 준다 */
.peek { display: none; }
@media (min-width: 1180px) and (max-width: 1365.98px), (min-width: 1180px) and (max-aspect-ratio: 14/9) {
  .peek { display: block; }
}
