:root {
  color-scheme: light dark;
  font-family: system-ui,sans-serif;
  --bg: #f4f7f4;
  --card: #fff;
  --ink: #13332c;
  --muted: #45665d;
  --line: #bdcfc7;
  --accent: #006653;
  --on: #fff;
  --water: #50bfab;
}

@media(prefers-color-scheme:dark) {
  :root {
    --bg: #102822;
    --card: #18372f;
    --ink: #ebf5ec;
    --muted: #b4cec2;
    --line: #52756a;
    --accent: #86e3cd;
    --on: #10352c;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

main {
  max-width: 680px;
  margin: auto;
  padding: clamp(12px,4vw,28px) clamp(8px,4vw,20px) 48px;
}

header,nav,.actions,.period,.record {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

header,.period,.record {
  justify-content: space-between;
}

nav {
  margin-block: 16px;
  border-bottom: 1px solid var(--line);
}

a {
  color: inherit;
  text-decoration: none;
}

.brand {
  font: 700 2rem Georgia,serif;
}

nav a {
  padding: .7rem .65rem;
  border-bottom: 3px solid transparent;
}

nav a[aria-current] {
  border-color: var(--accent);
}

h1,h2,p {
  margin: 0 0 .65rem;
}

h1 {
  font: 700 2rem Georgia,serif;
}

h2 {
  font-size: 1.15rem;
  margin-top: 1.25rem;
}

p {
  color: var(--muted);
}

button,input,.file {
  font: inherit;
}

.file,button,input {
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--card);
  color: var(--ink);
  padding: .55rem .75rem;
}

button,.file {
  min-height: 44px;
  cursor: pointer;
}

button:focus-visible,a:focus-visible,input:focus-visible,.file:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.primary,button[aria-pressed=true] {
  background: var(--accent);
  color: var(--on);
  font-weight: 700;
}

.summary {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  padding: clamp(12px,4vw,24px);
  border-radius: 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.progress {
  grid-column: 1/-1;
}

progress {
  width: 100%;
  accent-color: var(--accent);
}

#total {
  display: block;
  font-size: clamp(1.4rem,7vw,3rem);
  overflow-wrap: anywhere;
}

.record {
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
}

.record small {
  color: var(--muted);
}

form label {
  display: block;
  margin-bottom: .75rem;
}

label input:not([type=checkbox],[type=file]) {
  display: block;
  margin-top: .25rem;
  max-width: 100%;
}

.file input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  padding: 0;
}

.period {
  flex-wrap: nowrap;
  margin-block: 12px;
}

.period h2 {
  margin: 0;
  text-align: center;
}

#chart {
  display: grid;
  grid-template-columns: repeat(7,minmax(0,1fr));
  gap: 3px;
}

.day {
  padding: .35rem 0;
  min-width: 0;
  text-align: center;
}

.day small {
  display: block;
  font-size: .7rem;
}

.bar-track {
  display: block;
  height: 72px;
  background: var(--bg);
  position: relative;
  margin: 0 auto .3rem;
  width: 68%;
  border-radius: 3px;
}

.bar,.goal-marker {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--water);
}

.goal-marker {
  height: 2px;
  background: var(--ink);
}

dialog {
  max-width: min(92vw,420px);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--card);
  color: var(--ink);
  padding: 1rem;
}

dialog::backdrop {
  background: #001b1499;
}

dialog h2 {
  margin-top: 0;
}

#notice:empty {
  display: none;
}

[hidden] {
  display: none!important;
}

@media(max-width:250px) {
  main {
    padding: 12px 8px 28px;
  }
  nav {
    justify-content: center;
    gap: 0;
  }
  nav a {
    padding: .5rem .3rem;
    font-size: .875rem;
  }
  .summary {
    padding: 9px;
    gap: 4px;
  }
  .day small {
    font-size: .62rem;
  }
}

main {
  padding-left: max(clamp(8px,4vw,20px),env(safe-area-inset-left));
  padding-right: max(clamp(8px,4vw,20px),env(safe-area-inset-right));
  padding-bottom: max(48px,env(safe-area-inset-bottom));
  padding-top: max(clamp(12px,4vw,28px),env(safe-area-inset-top));
}
@font-face {
  font-family: Cormorant Garamond;
  src: url("./cormorant_garamond.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #faebcd;
  --card: #f3e3c2;
  --ink: #173d33;
  --muted: #3f5e51;
  --line: #9c8c72;
  --accent: #315b50;
  --on: #fff4de;
  --water: #4d9b88;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #102b29;
    --card: #173d35;
    --ink: #e8f9ee;
    --muted: #b4d0c3;
    --line: #669184;
    --accent: #a8bfaf;
    --on: #18352d;
    --water: #79bfae;
  }
}

.brand, h1 {
  font-family: Cormorant Garamond, Georgia, serif;
}

.ceramic-cup {
  display: block;
  width: clamp(52px, 24vw, 124px);
  height: auto;
}

#reminder button {
  min-height: 48px;
}
