/**
 * Base Styles
 * Imports design tokens and applies global styles
 */

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

/* Base Typography */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: 90px; /* Header height */
}

/* Wrapper */
.wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Main Content */
main {
  flex: 1;
  padding: var(--spacing-4);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

/* Links */
a {
  color: var(--color-info);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-slate-700);
  text-decoration: underline;
}

/* Focus Visible */
:focus-visible {
  outline: 2px solid var(--color-info);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background-color: var(--color-info-light);
  color: var(--color-slate-900);
}

/* Monospace for Data */
code,
kbd,
pre,
samp,
.mono {
  font-family: var(--font-mono);
}

/* Tables - Base */
table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
  text-align: left;
  border-bottom: 1px solid var(--table-border);
}

th {
  font-weight: var(--font-weight-semibold);
  background-color: var(--table-header-bg);
}

/* Form Elements - Base */
input,
select,
textarea,
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Disabled State */
[disabled],
.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* テンプレートDLボタン（partials/_template_download.html 専用）。
   base.css は base.html と forecast_base.html の双方が読む唯一の自前CSSなので、
   設定系・forecast 系のどちらの画面でも同じ見た目になる。
   要素修飾 a.〜 なのは、後から読まれる settings.css の .btn{border:none} に
   枠線を潰されないようにするため（クラスのみだと詳細度が同じで後勝ちになる）。 */
a.btn-template-dl {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  background: transparent;
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
}

a.btn-template-dl:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
